Take the 2-minute tour ×

I need to sync some data from my Phonegap app back to the server. I have a PHP script on the server to receive the data and I need to be able to post some values to it from my App.

I am storing my data in a SQLite database and I want to output it and AJAX it to the server.

I don't seem to be getting any data sent to the PHP script and the onSuccess function is just returning a copy of the data it's sending rather than a response from the server. If I console.log the currentRow object, it returns a string of data for each row as expected.

Can someone point me in the right direction?

Here is the database query and the AJAX call...

var query = "SELECT * FROM fixturesfittings WHERE propertyid = ?;"
localDatabase.transaction(function (trxn) {
    trxn.executeSql(query, [propertyid], function (transaction, thedata) {
        var i = 0,currentRow;
        for (i; i < thedata.rows.length; i++) {
        currentRow = thedata.rows.item(i);

            type: "POST",
            url: "http://myserver.com/putData.php",
            cache: false,
            dataType: "text",
            data: currentRow,
            success: function(mydata) {
            error: function() {


share|improve this question
Is currentRow a set of key/value pairs? e.g. key1=value1&key2=value2 –  Musa Mar 3 '13 at 23:37
Yes, kind of like a JSON string - each row looks like this: {"condition":"Good condition","propertyid":1,"fixture":"Thermostat","type":" ","category":"Fixtures","colour":"White","quantity":"1","roomtype":"Entrance and Hallway","material":"Plastic"} –  Dan Mar 4 '13 at 9:44

1 Answer 1

up vote 0 down vote accepted

I think the problem was actually in the php. I stripped it all back, sent one row at a time and retuned a JSON string instead of text and all is well now

share|improve this answer

Your Answer


