How to escape html tags ? in json retrived from php in phonegap android -


i creating app in i'm using php in server side.when ajax call made calling php retrieve data table issue table contains html & special characters tags error in ajax :

05-31 00:59:07.670: d/cordovalog(872): server not responding... please try again: syntaxerror: unexpected token < 05-31 00:59:07.670: i/chromium(872): [info:console(342)] "server not responding... please try again: syntaxerror: unexpected token <", source: file:///android_asset/www/home.html (342) 

can tell how solve issue. in advance.

you may use escapehtml returns html escaped representation of given plain text. more info see @ escapehtml

or may use textutils.htmlencode("your json tag") encode html.

edit
using phonegap may use htmlencoding php

htmlentities($str, ent_quotes); 

for more information see @ htmlentities in php

to encode html in php , decode in app,you may refer link
using php’s json encode , decode functions handle data sent , app


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -