Jquery Autocomplete JSON string parsing error

前端 未结 2 1882
孤街浪徒
孤街浪徒 2021-01-16 07:08

I want to use Jquery autocomplete in my web application but encounter issues. I am developing my application in ASP.NET and JQuery.

Here\'s the part of the Autocopm

2条回答
  •  情话喂你
    2021-01-16 07:25

    I simply suggest you instead of using any other method you can use :

    success: function (data, status, xhr) {
        var jsonArray = JSON.parse(data);  // Normal way
    }
    

    Other way

    success: function (data, status, xhr) {
        var jsonArray = $.parseJSON(data); // using jQuery
    }
    

    In this way it will be converted to a simple JavaScript object which you can easily manipulate on your UI/DOM.

提交回复
热议问题