Ajax send to server in webSqlSync.js
perqa opened this issue · 6 comments
When running the tests against my own PHP server, I could not pick up any data from the client at all - until I made a small change to the ajax part in webSqlSync.js.
On row 195 in webSqlSync.js, I replaced
data: JSON.stringify(dataToSync),
with
data: 'data='+JSON.stringify(dataToSync),
I was then able to pick up the parameter 'data' from the query string. I'm not sure if this is a bug or if I'm doing something wrong?
====== Modified code on row 195 =====
192: jQuery.ajax({
193: url: self.serverUrl,
194: type: 'POST',
195: data: 'data='+JSON.stringify(dataToSync),
196: dataType: 'json',
All the Best,
Per Q A
Strange, which version of jQuery are you using? (I use an old version 1.4.3)
I tried first with that old version, 1.4.3, and then with a newer, v1.8.2, but maybe I'm doing something wrong? How do you pick up the data on the server? I am using PHP on the server. I checked the $_POST and $_REQUEST arrays, and they were empty until I did the modification.
Is it OK now ?
Well, it works with the modification described above. I never got the original code to work. How do you pick up the data on the server?
In PHP you can get data in this way:
$jsonString = file_get_contents('php://input');
Thanks again Takeno.