how to decode encoded json data from php in phonegap android -
i want store table data server android local storage. issue table data might content special character '<' or '>' both. when ajax call made ways sqllite error code 13 while inserting data server. , if try store simple localstorage server working perfectly. tried encode data in php , send data android app in json form.but know blank data in ajax data. here php code encode data:
$select_table = 'select * users'; $resulttabledata = $conn->query($select_table); while ($row1 = $resulttabledata->fetch()) { $temporarydata[] = htmlentities(utf8_encode($row1),ent_quotes); } $data[$row] = $temporarydata; mysql_close($con); require_once('json.php'); $json = new services_json(); echo ($json->encode($data));
here ajax code in phonegap android:
$.ajax({ url: urlserver + 'getdynamicformdata.php', contenttype: 'application/json', beforesend: function() { $.mobile.loading('show'); }, complete: function() { console.log("ajax complete"); createtable(); }, datatype: 'json', data: { companycode : companycode }, success: function(data) { console.log('value in data: '+json.stringify(data)); if (data != null) { dynamic_tabledetails = data.table_details; table_data = data; gettabledetails(dynamic_tabledetails); } else { alert("error message"); } }, error: function(xhr, ajaxoptions, thrownerror) { console.log("server not responding... please try again: "+thrownerror); } });
if json answer, try looking gson, may you.
Comments
Post a Comment