How can I request a url using AJAX

Posted by Nikhil Dinesh on Stack Overflow See other posts from Stack Overflow or by Nikhil Dinesh
Published on 2011-05-19T10:18:40Z Indexed on 2012/11/21 11:03 UTC
Read the original article Hit count: 191

Filed under:
|
|
|
|

I am quite new in this area. I need to find out how to make a request to my solr server using Ajax How can I give a url(my solr server's url) in request Any body know how to deal with this? How can i make a request to the below mentioned url

http://mysite:8080/solr/select/?q=%2A%3A%2A&version=2.2&start=0&rows=100&indent=on

See here: Corrected the Code Snippet as below

function getProductIds() {
    var xmlhttp;
    if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
    else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) console.dir(xmlhttp);
        else alert('no response');
        var ajaxURL = "http://localhost:8080/solr/select/?q=*:*&version=2.2&start=0&rows=100&indent=on";
        xmlhttp.open("GET", ajaxURL, true);
        xmlhttp.send();
    }

This is my code, it always showing "no response"
Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about AJAX