how to send json data to server in cordova android -
hi frnd form lastly 2 days trying send json info server not working posting js file , check if error. , seek send json info using xmlhttprequest. , if other function , alter have plz tell me. developing cordova project in eclipse.and if other thing , file have alter tell me js file , on click registration button calling method.
function get() { alert("function called"); var name_field_value=document.getelementbyid("name_field").value; var email_field_value=document.getelementbyid("email_field").value; var password_field_value=document.getelementbyid("password_field").value; var phone_field_value=document.getelementbyid("phone_field").value; var jsondata= { "name": name_field_value, "mobile_number": phone_field_value, "email": email_field_value, "password": password_field_value } var request = new xmlhttprequest(); request.open("post", "http://www.jiyonatural.com/accountmanagements/insert_new_user", true); request.onreadystatechange = function() { if (request.readystate == 4) { alert(request.status);//this alert working , getting 0 status if (request.status == 200 || request.status == 0) { // -> request.responsetext <- result /*var tweets = json.parse(request.responsetext);*/ alert(request.responsetext);//this alert not working// //if create other alert works }else{ alert("function called3");} } } request.send(json.stringify(jsondata)); }
looks question incomplete. in experience error lies in server code friend.
and should utilize ajax method in jquery communication server.its easier xmlhttprequest.
json cordova
No comments:
Post a Comment