I've got array send from php that I'm sending over JSON to javascript file. It works using jquery.GET, but I want to use just javascript. I know there's a way, but I can't find it and I bet there's a folk that knows the answer.

This is my code for jquery:

$.get('loadSomething.php', function(data) {

   var dataSomething = data.something;

       // Then working with the data I received from PHP file

}

I want the same thing but using only javascript.

link|improve this question

75% accept rate
jQuery is javascript! – Rob Forrest 24 mins ago
I know it is, but on mobile platform it's slow. – jesteuvidim 24 mins ago
feedback

1 Answer

The underlying object of ajax functionality is called XMLHttpRequest, but browser support especially older ones varies greatly in support of features or even the way you get a hold of this object, see the Browser compatibility table of the MDN page. Generally you don't want to reinvent the whole compatibility mess that JQuery and other frameworks do for you.

This getting started guide should prove itself helpful.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.