Skip to content Skip to sidebar Skip to footer

Using Jquery Autocomplete I Am Trying To Get The Value In The Text Box As Table The Datas Are Not Coming From Json Using Ajax In The Text Field

This is the first time I am using ajax with json for autocomplete (Jquery) the result will look like the auto-complete but the structure(output) will look like table. Here is my jq

Solution 1:

The problem can occur if the AJAX call interprets your data as XML rather than JSON. To solve this, try specifying the dataType for your AJAX call. For example:

$.ajax({
    url: "dummy.json",
    dataType: "json",
    success: function() {
        alert("got the file");  
    },
    error:function(xhr, ajaxOptions, thrownError) {
        console.log(xhr.status);
        console.log(thrownError);
    }
});

Also, consider using http://api.jquery.com/jquery.getjson/.

EDIT: contentType is used when data is sent to the server. And, dataType is used when data is retrieved from the server.

Post a Comment for "Using Jquery Autocomplete I Am Trying To Get The Value In The Text Box As Table The Datas Are Not Coming From Json Using Ajax In The Text Field"