0

I am making two ajax calls in one page via jquery.

First one is for autocomplete in jquery mockjax and second one is to get listing data.Both of them conflect with return data.

Here is for autocomple

 $.mockjax({
    url: '*',
    responseTime: 2000,
    contentType: "text/json",
    response: function (settings) {
        var query = settings.data.query,//this line give me error
        queryLowerCase = query.toLowerCase(),
            re = new RegExp('\\b' + $.Autocomplete.utils.escapeRegExChars(queryLowerCase), 'gi'),
            suggestions = $.grep(countriesArray, function (country) {
                 // return country.value.toLowerCase().indexOf(queryLowerCase) === 0;
                return re.test(country.value);
            }),
            response = {
                query: query,
                suggestions: suggestions
            };

        this.responseText = JSON.stringify(response);

Here is for listing data

  $.getJSON("getname.php?city="+city, function(json){ 
   $.each(json, function (i, item) {

Now both of them conflect with return data JSON.

How i can change JSON in $.getJSON

UPDATE:When i do not use getJSON then no issue,On calling getJSON give me issue

Update: Here is my setting for mockjax

    status:       200,
    statusText:   "OK",
    responseTime: 500,
    isTimeout:    false,
    contentType:  'text/plain',
    response:     '',
    responseText: '',
    responseXML:  '',
    proxy:        '',
    proxyType:    'GET',

    lastModified: null,
    etag:         '',
    headers: {
        etag: 'IJF@H#@923uf8023hFO@I#H#',
        'content-type' : 'text/plain'
    }
user3244721
  • 714
  • 2
  • 11
  • 29

0 Answers0