var myJSONP = new Request.JSONP({
url: 'register.php', //to be modified
callbackKey: 'submitCallback',
data: {
first_name: fname,
last_name: lname,
},
onTimeout: function() {
submitting = false;
},
onComplete: function(json){
submitting = false;
if(json.success==0) {
setError(json.message);
}
else if(json.success==1) {
$('thankyou').setStyles({display: 'block', opacity: 0});
$('form').setStyle('display','none');
}
}
}).send();
It always show
SyntaxError: invalid label
So for your register.php need to change append some special before your json string as below
echo $_GET['callback']."('.json_encode($response).");";
die;.
It's really bad, but mootoos need to do like this for ajax request