I'm currently working on an AJAX function that dynamically changes the color of a specific button. However, I have only been able to achieve this in a static manner by manually inputting the values sent to the corresponding php script. My goal is to be able to call this function within the html body with parameters, which will then be passed through the xmlhttp.send method. Despite my attempts, I haven't been successful. For instance, when calling the ajaxFunction() below, it works fine (passing x=0 and t=1 as parameters)
$ function ajaxFunction() { ... xmlhttp.open("POST","example.php",true);
xmlhttp.onreadystatechange = handleServerResponse;
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send("x=0&t=1");}
However, if I try to call the function with additional parameters like ajaxFunction(0,1), how can I inject these values into the xmlhttp.send method?
If you have any ideas or suggestions, please feel free to share.
Thank you in advance.