$.ajax Return js
$.ajax Return js
I need to return a string of JS from my php file.
In my ajax.php file these are the last lines ($js is a string of js generated dynamically, it works as
its calling a function I'm using at the load of the page):
$js = getData($day,$the_vote);
header("content-type: text/javascript"); (also tried removing this)
echo $js;
Above that data is inserted into the db and that works. Here is my code for the js:
var the_vote = $(this).attr('id');
$.ajax({
type: "POST",
url: "http://seasons-beatings.com/beta/ajax/ajax.php",
data:{vote:the_vote},
dataType: "script"
});
return false;
Any help is much appreciated. Thanks!