php - Titanium handle HTML form JSON request -
i have json api plugin wordpress site, trows out posts.
in titanium alloy project i'am getting json en parse it, put in tableview.
but special chars " converted “ , titanium show this. how decode in titanium?
json code:
var data = []; var sendit = ti.network.createhttpclient({ onerror : function(e) { ti.api.debug(e.error); alert('there error during connection'); }, timeout : 5000, }); // here have change local ip sendit.open('get', 'http://development.webor.nl/driveeatsleep/api/get_posts/'); sendit.send(); // function called upon successful response sendit.onload = function() { var json = json.parse(this.responsetext); // var json = json.todo; // if database empty show alert if (json.length == 0) { $.hotellist.headertitle = "the database row empty"; } // emptying data refresh view // insert json data table view var hotels = json.posts; ( var = 0, ilen = hotels.length; < ilen; i++) { if(hotels[i].excerpt.length >= 50){ var excerpt = hotels[i].excerpt.substring(50,0) + '...' ; }else{ var excerpt = hotels[i].excerpt; } // remove html tags , coding excerpt = excerpt.replace( /<[^>]+>/g,''); data.push(alloy.createcontroller('row', { icon : hotels[i].thumbnail, title : hotels[i].title, description : excerpt }).getview()); // data.push(row); ti.api.info(hotels[i].thumbnail); ti.api.info(hotels[i].title); } $.hotellist.setdata(data); };
i found ugly working solution.
in titanium added array special chars, , equal normal chars replace with.
Comments
Post a Comment