1

Currently I am working on mobile web application using Phone gap.. here, I am passing data between client (HTML page in mobile) and server (php in server) using GET method ... now everything is working fine but when i try to change it to POST it is not working.....! what might be the problem..

Client side :

$.ajax({ url:'xxx?callback=?', data:{userId:id}, dataType:'jsonp', type:'POST', success:function(output){ alert(output); }});

Server side : I am using $_POST['id'];

Thanks in advance.

3
  • 2
    It's in the code. We can't see it though... Commented May 16, 2014 at 4:42
  • you need to post the code Commented May 16, 2014 at 4:43
  • 1
    It's not working with POST, ok. Then you'll need to check and see if any of your PHP contains $_GET and change it to $_POST. Do show your full code, PHP especially. Commented May 16, 2014 at 4:46

1 Answer 1

2

Cross-domain AJAX calls using JSONP works only with GET. JSONP works only for get requests as it uses javascript tag for the request. JSONP makes sense only when used with a script element. For each new JSONP request, the browser must add a new element, or reuse an existing one

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.