javascript - AJAX + jQuery confusion? -


so right i'm trying understand piece of code:

vader.attraction = {};  vader.servicebaseurl = './services/' var scriptlocation = vader.servicebaseurl + 'attraction?callback=?';  $.ajax(scriptlocation, {     datatype: 'jsonp',     error: function (jqxhr, textstatus, errorthrown) {         console.log(errorthrown);     },     success: function (data) {         vader.attraction.data = data;     }  }); 

i can understand gist of of it, uses jquery 's .ajax() method data. question on line right here:

vader.servicebaseurl = './services/' var scriptlocation = vader.servicebaseurl + 'attraction?callback=?'; 

what ./services/ , attraction?callback=? come from?? attraction?callback=? part, ajax? i'm pretty sure attraction table name in database..... can't figured out syntax, , i've googled callback=? no avail so....

maybe dumb question, i'm confused since i'm new ajax,jquery, , javascript in general..... appreciated, thank you!!

attraction?callback=? bits of url processed server. you'd need go , examine server side code find out does.

all ajax send request url , gathers whatever returned it. url doesn't need special bits ajax specific, in above example, put scriptlocation , if valid, error-free url returned something, you'd in success function.

in case data returned, assigned javascript object vader.attraction - url queried ajax has create successful request code executed , code executed on success.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -