i am using ajax to get some data over to my page and use .html() to change the html content of a div. Everything works fine in firefox , google chrome , safari , opera except INTERNET EXPLORER.
IE 7 , 8 , 9 are not responding to the .html() funciton, the contents of that div remains unchanged.
here's my code:
var userurl = $('#userthumb a').attr('href');
$(document).ready(function(){
$('#userthumb').after("<div id='to-change'>Loading...</div>");
$.ajax({
type: "GET",
url: "parse.php",
data: "url=" + userurl,
dataType: 'json',
cache: false,
success: function(data)
{
var respond = data['respond'];
$('#to-change').html(respond + 'profile');
} //end of success
}); //end of ajax
});
is there any problems or is there a way to solve the IE problem?
试试这个:$('#to-change')。empty()。append(respond +'profile');
尝试
$('#to-change').html($.parseJSON(data).respond + 'profile');
This might solve it:
success: function(data) {
eval('var jSON = '+data);
$('#to-change').html(jSON['respond'] + 'profile');
} //end of success
EDIT: Make sure your returning data is in the format, for example:
{'respond':'it worked as expected','.....':'....'}
In my vbscripts I return:
response.write "{'Success':'MoveOn','....':'....'}" or
response.write "{'Success':'Error:........','....':'....'}"
Then,
eval('var jSON='+data);
if (jSON['Success'] == 'MoveOn') .......
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.