json - jquery form callback receiving null -
i have jquery form:
var uploadformoptions = { target: '#ur', beforesubmit: uploadvalidate, // pre-submit callback success: uploadresponse, // post-submit callback datatype: 'json', error: function (xhr, ajaxoptions, thrownerror) { alert(xhr.status); alert(thrownerror); }, resetform: true // reset form after successful submit }; $('#upload').ajaxform(uploadformoptions);
the response function declared:
function uploadresponse(responsetext, statustext, xhr, $form) {
and ends responsetext === null. error function not called.
the script being called php , returns value. i'm @ loss. can help?
thanks.
the output in script is
if ( is_numeric( $uid["uid"] ) ) $bool = setcookie("gp_uid", $uid["uid"], time()+3600*24*365*10 /*expire: 10 years*/, '/'/*cookie-path*/); print json_encode($uid);
you might need set response content type json below:
header('content-type: application/json');
Comments
Post a Comment