$('#loginForm').submit(function() {
$("#loginsubmit",this).attr("disabled","disabled");
var u = $("#loginemail", this).val();
var p = $("#loginpassword", this).val();
var postTo = 'http://www.example.com/login.php';
if(u != '' && p!= '') {
//navigator.notification.alert("not empty"+u, function() {});
var apiurl = "http://www.mapyi.com/api/mapyi/client.php?"+"action=verlogin&pass="+p+"&email="+u;
$.ajax({
url: apiurl,
dataType: 'jsonp',
jsonp: 'jsoncallback',
timeout: 5000,
success: function(data){
navigator.notification.alert("not empty"+data);
},
error: function(msg){
navigator.notification.alert("ERROR"+msg);
}
});
} /* end if u and p */
//hide();
//$('#homepage').show();
return false;
});
I have added access in phonegap.xml , also aupdate manifest.xml for android. The php response is in json :
/* PHP CODE SErver side */
/* output in necessary format JSON */
header('Content-type: application/json');
echo json_encode(array('posts'=>$ret));
I do not know what I'm missing, It always shows the ERROR dialog box with output ERROR [object] [object]
**RESOLVED I solved it myself, I was not adding header information in php service. header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']); header('Cache-Control: no-cache, must-revalidate'); Thanks CODER DECODER ENCODER for your time **