I'm a bit new to ajax and my javascript isn't to shabby I'm having a difficult time figuring this out. I'm trying to add values from a JSON string located on a separate url to my html code through an AJAX Get method.
Currently this is my code:
$.ajax({
dataType: "jsonp",
jsonp: 'callback',
cache: false,
url: "http://www.url.com/userInfo/currentUserInfo",
success: function(data) {
$("#name").val("firstName");
$("#avatar").val("userProfileImg");
$("#notNum").val("numOfNotifications");
}
});
Html
<div id="name"></div> <div id="avatar"></div> <div id="notNum"></div>
I'm pretty sure I'm missing something in the ajax script.. but to be honest I can't figure out what. Could someone lend a helping hand?
Thanks!
jsonp
– Arun P Johny May 31 '13 at 2:47