Including a global variable on a wi-fi setup page using SoftAP

I would like to use the standard SoftAP wifi setup process and code but modified to include the device name and the product type (which is a string variable). Both of these are constant (i.e. are not dynamically changing) and could be included in the .html char array? I have tried modifying the html by adding in the variable "+variable name+" also Created a var in the javascript and displayed this in the html and that doesn’t work either.

The methods I have seen used involve creating a particle cloud var and then doing a particle call in the javascript and parsing the JSON returned to get the variable. These examples hardcode the DEVICE-ID and also the AUTH-CODE which is not something I want to do.

Is there any simple method that avoids hardcoded AUTH-CODE that can read a global var into the html or allow the javascript to access the variable? Apologies if this is a dumb question - html/javascript is not my area.

you are building a product?

there is an API that allows for obtaining an auth token.

@BulldogLowell, I am building products which is why I want to use the same code and parameterise the product type and serial number/device name. What is the API and do you have any links to examples of how to use it? Wouldn’t there be a way to change the html in char index_html[] and isn’t there a simpler approach like use memcpy() or similar to over write the char array spaces where the product type and serial number are? Clearly not elegant!

hmmm… not sure I fully understand what you are looking for.

if this is your question, and you are dealing with a Particle Product then you need to incorporate access to the device through the API for authentication, there is a Javascript toolkit.

The wifi setup web page - I want to include the product type and serial number. The serial number is the same as the SSID for the device hotspot so really all I need to insert is the product type which is a string.

and you want this inserted into the boilerplate SoftAP web page?

Like this.

@armor, did you ever get this figured out.

I too am trying to show the serial number in the exact same spot.

Sorry - no I didn’t.