javascript - Ajax Post request example -


i wondering if me simple ajax request example can wrap head around whole idea. tried testing ajax request search word "rails" on github. code looks this:

$.ajax({ url: 'www.github.com', type: 'post', contenttype: 'application/x-www-form-urlencoded', data: {     q: 'rails' }, success: function(data) {     console.log(data); }  }); 

this request responding 404 response. so, i'm curious how supposed know key names "data" element should be? when inspected search bar on github, told me name of element q. hence why used key "q" , wanted search "rails". if me example or perhaps provide better 1 appreciated. thanks!

try add http in url, but, security reason can't ajax crossdomain request without autorisation of github.com domain in case.

http://api.jquery.com/jquery.ajax/


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -