I have an html file(index.html) which calls a php file(pdj.php) via javascipt and populates the output in a div(pdj). This works.
$.ajax({
url: '../command/pdj.php',
type: "POST",
data: ({xparam: xparam}),
success: function(data){
var arraydata = $.parseJSON(data);
$("#pdj").html(arraydata[0]);
}
});
The php file needs a javascript file(spinner.js) to work.
1) Adding the javascipt file in index.html does not use it.
2) Including in pdj.php causes an error include_once('spinner.js');
Uncaught SyntaxError: Unexpected token / in JSON at position 1
at Function.parse [as parseJSON] (<anonymous>)
at Object.success (pdj.js:40)
at fire (jquery-3.3.1.js:3268)
I am guessing my ajax call is wrong... Can you suggest how to fix this?
Thanks in advance
includeandinclude_onceis there for read and evaluate php code docs include - not javascript!