Reputation: 523
From a PhoneGap app on iOS I am trying to do a jQuery Post call to a PHP file that can be found on a server. This is the command:
$.post({url:'http://example.com/uploadtest/addContent.php', data: JSONstring, success:contentSent});
On the server I'm logging any occasion when addContent.php
is called. Unfortunately, it never is. Neither is the contentSent()
method:
function contentSent(data, textStatus)
{
console.log("Did it get into the callback? Status:" + textStatus);
var response = JSON.parse(data);
console.log("Response: " + data);
}
My problem is that I get absolutely no feedback, no error message, nothing. It's just as if that line of code wouldn't be there. Does someone know what the problems is, or at least how I may get some kind of status message / error code?
Update 1: "GET" shows the same behavior.
Update 2: The syntax I'm using in the upper example is faulty, but this (AFAIK correct) syntax doesn't work either: $.get('http://example.com/uploadtest/getTest.php', JSONstring, successFunction);
Update 3: The problem does not seem to be device-related, it shows the same behavior from the emulator.
Upvotes: 0
Views: 2806
Reputation: 523
I found the answer, and it was way to simple. In the whitelist (Supporting Files/PhoneGap.plist) I had put my domain ("http://example.com") but that wasn't enough.
Putting an asterisk (*) there was the solution...
Upvotes: 1