Solved

Convert jquery ajax call to pure javascript

Posted on 2016-10-25
3
129 Views
Last Modified: 2016-11-01
HI,
I am currently using jquery to make an ajax call :
$.ajax({
        url: url,
        type: 'POST',
        contentType: 'application/json',
        headers: {
            'X-hfh': this.data
        },
        dataType: 'json',
        success: function(result) {
            $.each(result, function(idx, item) {
                mybuddyList.push({
                    DisplayText: item.name,
                    JID: item.id,
                    ImageURL: item.profileImage
                });
            });
        },
        error: function() {
            console.log("Error");
        }
    });

Open in new window

I want to get rid of jquery and use only javascript to achieve the same.
How do i do it.

Thanks
0
Comment
Question by:Rohit Bajaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 22

Accepted Solution

by:
Kim Walker earned 300 total points
ID: 41859718
There are entire books written about how to do ajax without jQuery. If you insist on doing it without using jQuery, I would suggest Head First Ajax by O'Reilly. But I highly recommend using jQuery.
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 150 total points
ID: 41865811
How do i do it.
Open for example this one : https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js

Go to line 7116 to 8101 to see what jQuery do.
You need to cleanup the code.
If you find any jQuery use, check if you can do simpler or just do a new search inside the file.

It's not a simpler job as it required to have lot of time maybe it's your case.
0
 
LVL 43

Assisted Solution

by:Rob
Rob earned 50 total points
ID: 41866527
Given jQuery IS JavaScript this seems like an odd request... There's no reason to ever do this unless this is for an assignment?

https://www.experts-exchange.com/articles/12264/Javascript-Frameworks-what-are-they.html
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question