Jquery ajax request on IOS using Phonegap - Ajax not working -


i have simple html login form, deployed on xcode using phonegap framework.

when submitlogin button clicked, sent login credentials using ajax request verify login. javascript function handle login:

function submitloginform (login_id, login_pass){     //here need communicate php files in server     console.log ("debug 1 ");     $.ajax({         type: "post",         url: "http://192.168.1.9/serverapp/loginhandler.php",         data: "login_id=" + login_id + "&login_password=" + login_pass,         success: function(loginstatus){               navigator.notification.alert ("login request sent");               console.log ("debug 2");               if (loginstatus == "success"){                 console.log ("debug 3 ");                 location.href = "main.html";               }               else{                 console.log ("debug 4 ");                 location.href="index.html?errcode=1";               }          }     });     console.log ("debug 5 "); } 

after submitting login form, see console printed "debug 1" message. wrong in case? if ajax request fails, still supposed print "debug 5" message, did not print , skip whole thing, except first debug message.

i access php url browser, sure problem not php code. have been trying spend several hours no result. have similar problem phonegap ios framework, , how did fix it?

problem solved.

i using external jquery file http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

and appeared external jquery url blocked ios simulator, have put url in whitelist.

steps:

  • in xcode phonegap project, browse resources folder.
  • go supporting files directory, , edit phonegap.plist file.
  • in external host list, add external urls want access (including external jquery url, , other url use in ajax request).

i hope useful other developers encounter same issue mine.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -