javascript - jquery ajax ParseError with Musixmatch API -
i using jquery 1.11.3 following code:
$.ajax({ type: "get", data: { apikey: apimusixkey, q_track: q, page_size: 10 }, url: "http://api.musixmatch.com/ws/1.1/track.search", datatype: "jsonp", contenttype: 'application/json', success: function(data) { //console.log(json); }, error: function(jqxhr, textstatus, errorthrown) { console.log(jqxhr); console.log(textstatus); console.log(errorthrown); } });
i getting error:
parseerror... [] not called
what doing wrong?
looks missing few things on ajax. need specify name of callback function handle jsonp. also, there's format parameter need use musixmatch api. checkout plunker: http://plnkr.co/edit/xw6tfujquw8o8evpeegu?p=preview
$(function(){ $.ajax({ type: "get", data: { apikey:"309788821d050a0623303261b9ddedc4", q_track:"back december", q_artist:"taylor%20swift", f_has_lyrics: 1, format:"jsonp", callback:"jsonp_callback" }, url: "http://api.musixmatch.com/ws/1.1/track.search", datatype: "jsonp", jsonpcallback: 'jsonp_callback', contenttype: 'application/json', success: function(data) { console.log(data); }, error: function(jqxhr, textstatus, errorthrown) { console.log(jqxhr); console.log(textstatus); console.log(errorthrown); } }); });
Comments
Post a Comment