I'm doing a jQuery Ajax call to a PHP script that returns this string variable in Javascript:
"<div id=\"page\">
\t"
I'm probably missing something simple here, but is there a way to revert
to <br/>
, but more importantly, reverting \"page\"
to "page"
? I just can't figure it out.
Javascript looks like this:
$.ajax({
type: 'POST',
dataType: "JSON",
url: sameURLasPHPscript,
success:function(data){
// successful request; do something with the data
$('body').text(data);
},
error:function(){
// failed request; give feedback to user
alert('ErrorMessage');
}
});
My php file looks like this:
$url = "someURL/controller/action/getID";
$a = file_get_contents($url);
echo json_encode($a);
Edit : Solution can be found here: http://blog.dkferguson.com/index.cfm/2011/3/15/jQuery-Mobile-styling-loaded-content