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.

63 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. 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
  6. 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
  7. Sukere InfoTech is the best high-quality vendors of search engine optimization training in Chennai with search engine optimization specialists.

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

    ReplyDelete
  9. 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
  10. 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
  11. 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
  12. Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
    software testing course in Chennai

    ReplyDelete
  13. 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
  14. 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
  15. The blog you presented was very nice and interesting which helped me to get update on the recent technologies.

    angularjs training in chennai

    devops training in chennai

    ReplyDelete
  16. Wonderful blog with great piece of information. I've been following your blogs for a while and I'm really impressed by your works. Keep sharing more such blogs. good jobs .
    Ai & Artificial Intelligence Course in Chennai
    PHP Training in Chennai
    Ethical Hacking Course in Chennai Blue Prism Training in Chennai
    UiPath Training in Chennai

    ReplyDelete
  17. The python programming language is a modern web programming language that was originally conceived and developed by Guido van Rossum in the 1980s. Since that time, Python has evolved into a high-performance programming language that is modular and extensible. unindent does not match any outer indentation level

    ReplyDelete
  18. This was nice and amazing and the given contents were very useful and the precision has given here is good.

    data science training institute in bangalore
    Data Science certification course in Bangalore

    ReplyDelete
  19. content is very useful. I'm glad to be here.

    Trading for beginners

    ReplyDelete
  20. Quickly this site will indisputably be famous among all blogging people, because of its fastidious articles or reviews.
    design agencies

    ReplyDelete

  21. This post is so interactive and informative.keep update more information...
    ccna Training in Tambaram
    ccna course in Chennai

    ReplyDelete
  22. I found the tips shared for feature selection and dimensionality reduction to be practical and applicable in real-world scenarios.data analytics course in chennai

    ReplyDelete