Please navigate to the bottom of the page for Table of Contents

Saturday, June 4, 2011

jQuery AJAX functions part 3–ajax()

The $.ajax() function underlies all Ajax requests sent by jQuery. This is by far the most complex function in the jQuery library. In fact, the jQuery official documentation marks this as a low-level function and recommends using one of the high level functions (such as get(), post(), etc.). This function accepts a single argument: a set of key/value pairs that configure the Ajax request.

From an interview perspective, it is important to understand how the other higher level functions map to this function.

jQuery.Get() call is equivalent to the following .ajax() call:

$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});



jQuery.Post() call maps out to the following .ajax() call:


$.ajax({
type: 'POST',
url: url,
data: data,
success: success
dataType: dataType
});



jQuery.GetJSON() maps to


$.ajax({
url: url,
dataType: 'json',
data: data,
success: callback
});



As you can see from the above, a consistent pattern is visible. If a type is not specified, GET is used. A url is almost always required. To pass in data, you use the data name. And, you can have a callback for success. Of course, there are a lot more parameters that can be configured. A few key ones are crossDomain for cross domain access for JSONP, error for error handling function, password for authenticated requests, and so on.

35 comments:

  1. It’s too informative blog and I am getting conglomerations of info’s. Thanks for sharing; I would like to see your updates regularly so keep blogging. If anyone looking ccna just get here
    ccna training in Chennai | ccna course in Chennai

    ReplyDelete
  2. SAP is one of the customer relationship management software and it support all end to end customer related process. To know more details about SAP modules please refer the following site.
    Regards..
    SAP Training in Chennai

    ReplyDelete
  3. Wow, brilliant article that I was searching for. Helps me a lot in taking class for my students, so using it in my work. Thanks a ton. Keep writing, would love to follow your posts.
    Shashaa
    Dot Net training in Chennai | Dot Net training in Chennai | Dot Net training in Chennai

    ReplyDelete

  4. Thank you for sharing this knowledge in a blogpost.Really simple and even more effective and this worked great, very useful tips
    http://hadooptraininginhyderabad.co.in/salesforce-training-in-hyderabad/

    ReplyDelete
  5. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it. The angular js programming language is very popular which are most widely used.
    Angularjs Training in Chennai | Angularjs training Chennai

    ReplyDelete
  6. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
    Node JS training in chennai | Node JS training institute in chennai

    ReplyDelete
  7. it is very nice article thanks for sharing this article to us , it is very nice article ,
    i really like like this article because i got good info about this article thanks for sharing this article to us best regards.

    sap hana online training

    ReplyDelete
  8. It is really nice blog you should handle very wonderful words to written this blog.It help lot of fresher to update their knowledge in Angularjs. Thanks for sharing.keep sharing more blogs.


    Angularjs Online Training

    ReplyDelete
  9. Sukere InfoTech is the best high-quality vendors of search engine optimization training in Chennai with search engine optimization specialists.

    ReplyDelete
  10. Thanks for sharing this useful information.keep on posting like this.
    SEO Training in Chennai

    ReplyDelete
  11. Its a fabulous blog i have ever read in past days. search jobs near by you in chennai.

    ReplyDelete
  12. Nice information about sap. i am looking SAP HANA Online Training with real time project.

    ReplyDelete
  13. Great information, thanks for posting.

    Professional Salesforce Training in Hyderabad@ Techiemills. we offer both classroom & online training with realtime projects + placement assistance . ( for students & professionals)
    salesforce training in Hyderabad


    salesforce training in Kphb

    ReplyDelete
  14. I like the post format as you create user engagement in the complete article. It seems round up of all published posts. Thanks for gauging the informative posts.
    cara menggugurkan kandungan
    http://jualobatpenggugurkandungan.net/ obat penggugur kandungan
    http://tandatandakehamilan.net/ tanda tanda kehamilan
    http://tandatandakehamilan.net/cara-cepat-dan-selamat-menggugurkan-kandungan/ cara menggugurkan kandungan
    http://obataborsi59.com/ obat aborsi
    http://obataborsi59.com/cara-menggugurkan-kandungan-dengan-cepat-dan-aman/ cara menggugurkan kandungan

    ReplyDelete
  15. Hi There,


    Muchas Gracias Mi Amigo! You make learning so effortless. Anyone can follow you and I would not mind following you to the moon coz I know you are like my north star.

    I'm not the original poster but I'm also working on a plugin framework which is kinda working but not as I want it. I can load a interface from a jar file, for example PluginInterface.class that can execute code from the original project. But if I want to have more classes inside the jar file the PluginInterface.class can't recognize them (ClassNotFoundException) and I have to place them in the project to use the classes. So my question is, how can I load the classes to the RAM (?) so I can place the class files in the jar file instead of the project bin. I find it hard to explain how this works, so if you need any further info I can give you some. Or do you want an entirely new thread for this problem?






    Once again thanks for your tutorial.



    Thank you,
    Irene Hynes

    ReplyDelete
  16. And indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had.

    big data training in chennai

    ReplyDelete
  17. Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
    software testing course in Chennai

    ReplyDelete
  18. "Techonolgy is updated day to day
    Thanks for sharing the info"
    salesforce Development Training Hyderabad

    ReplyDelete
  19. informative blog thanks for providing such a great information.
    Salesforce Training in Hyderabad

    ReplyDelete
  20. I wish to show thanks to you just for bailing me out of this particular trouble. As a result of checking through the net and meeting techniques that were not productive, I thought my life was done.fire and safety engineering course in chennai

    ReplyDelete
  21. Thanks for sharing the information, Salesforce experts as lot of opennings in multi-level companies , for more information
    Best Salesforce Training in Hyderabad
    Salesforce Online Training in Bangalore

    Salesforce Online Training in India

    ReplyDelete