php - Jquery getJSON throws: "Failed to load resource: cancelled" in Safari -


i've found few posts (here , across web) on issue , tried proposed solutions no success, there differences in original issue. example seems straightforward, i'd love input on this. here's code:

theuri = "https://<?= $_server['http_host'] ?>/validate.php"; thedata = {     'validationtype' : 'login',     'ident' : document.getelementbyid("login_ident").value,     'password' : document.getelementbyid("login_pw").value,     'logintries' : <?= $logintries ?> } $.getjson(theuri, thedata, function() {alert('success!')});

the "success!" alert shows fine error "failed load resource: cancelled" flashes through error console. "validate.php" follows (some of server code has been omitted clarity), assume variables valid values:

<?php echo '{'; echo '"result" : "' . $login_success . '",'; echo '"logintries" : "' . $logintries . '",'; echo '"feedback" : "' . $loginfeedback . '",'; echo '"feedbackclass" : "' . $logintextclass . '",'; if($login_success) {     echo '"userdata" : {';     $firstpass=true;     foreach ($g_auserdata $thekey => $thevalue) {         if(!$firstpass) echo ","; else $firstpass=false;         echo '"' . $thekey . '" : "' . $thevalue . '"';     }     echo '}'; } echo '}'; ?> 

which generates (sample data, of course):

 {"result" : "1","logintries" : "0","feedback" : "successful login!","feedbackclass" : "login_text","userdata" : {"firstname" : "gomez","memberid" : "39203","lastname" : "aadams","lastlogin" : "","message" : "","credhash" : "3baf7a67271ecfd93kdsid33s2a65c16a9413f652"}} 

which reformats to:

{     "result" : "1",     "logintries" : "0",     "feedback" : "successful login!",     "feedbackclass" : "login_text",     "userdata" : {         "firstname" : "gomez",         "memberid" : "39203",         "lastname" : "aadams",         "lastlogin" : "",         "message" : "",         "credhash" : "3baf7a67271ecfd93kdsid33s2a65c16a9413f652"     } }

any ideas? i've tried:

1) loading data querystring , omitting data param entirely.
2) changing call relative.
3) changing "https" "http".

update: ok. based on comments, paid stupid tax , had code generate json data without html trimmings. strangely, still getting same error. tried same fixes noted above, still not working.

so, turns out problem had naught ajax call, form (that had been converted ajax) being used inputs. once added "return false" form, cleared up.

but must lonesomeday reminding me how ajax works (it'd been awhile since i've coded.) on course of prepping question initially, able dig out other errors before post, all-in-all, asking question helped immensely.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -