Reputation: 637
I want to write id in ajax success
.html:
success: function (response) {
debugger;
if (response.d != null) {
$("#mycarousel").empty();
$.each(response.d, function (i, response) {
$("#mycarousel").append('<li id='"+response.Soid+"'><img src="../Images/DefaultPhotoMale.png" width="40" height="40" alt="image"/></li>');
});
jQuery('#mycarousel').jcarousel();
}
else {
}
},
error: function (xhr) {
}
but i get following error:
Upvotes: 0
Views: 41
Reputation: 69
You need to change your quotes like this :
$("#mycarousel").append('<li id="'+response.Soid+'"><img src="../Images/DefaultPhotoMale.png" width="40" height="40" alt="image"/></li>');
Upvotes: 2
Reputation: 1149
Check the usage of your quotes You did:
' '"+ +"' '
This generates an error, you used single quotes as string delimiter, then switched them around later
Change it to:
' "'+ +'" '
Upvotes: 0