Hi ,
I am struggling with the ajax inssue for quite few days.. Pl help.
i connected the device and copied the apps and config directory.
Here is the description of my apps.json file.
{
"name": "My Demo",
"url": "http://127.0.0.1:83/UserDrive/apps/demo/index.html",
"icon": "http://127.0.0.1:83/UserDrive/apps/demo/price_check_icon.png"
}
The index file contains username and password and a login button.
We have a webservice which takes username and password as argument in json object and send the response in json format.
I am susing the ajax call on the login button click from the index.html page (which is residing in my device).
Everytime i am getting the response as "'Not connect.\n Verify Network". (response code === 0)
The same url if i give in the browser works fine.
the device is having wifi connection also.
Here is the code:
var req = $.ajax({
type: 'post',
url: finalURL,
cache: false,
dataType: 'json',
success: function(d) {
alert('success');
},
error: function(jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
} else if (jqXHR.status === 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status === 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
alert('Requested JSON parse failed.');
} else if (exception === 'timeout') {
alert('Time out error.');
} else if (exception === 'abort') {
alert('Ajax request aborted.');
} else {
alert('Uncaught Error.\n' + jqXHR.responseText);
}
},
async: true
});
Please help.. what is the issue with this code..
Thank you,
Bhuvana.
Ajax call not working.. pl help.// Expert user has replied. |
1 Replies
Are you sure you want to do a POST instead of a GET? I do not see any data being passed for post. You did not provide what you are using for 'finalURL' as well. Also if the device is having Wifi issues then that may be the source of the problem. You may not have RevA hardware - I would check with whoever you got it from.