It is better to pass an extra parameter with the AJAX request to avoid any conflict with
Output: Here, we just take input by statically or dynamically and pass it to JavaScript variable using the assignment operator. Try to use hidden field. So if you want to use your javascript variables in a scriptlet, you will need to submit them. Ajax makes use of the XMLHttpRequest object to communicate with servers. bruce lee kareem abdul-jabbar. Polska strona federacji WFMC. Pass javascript array to PHP using AJAX. Once the ajax request has occurred to ajax.php, the output of ajax.php is given back to the JavaScript program as the data variable.