$.ajax({
type: "POST",
url: "CityNamesData.asmx/GetCities",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
str = data.d;
}
});
var str1 = $.getJSON(jQuery.parseJSON(str));
return str1;
str contains
"[{"value":"1","text":"Amsterdam"},{"value":"2","text":"London"},{"value":"3","text":"Paris"},{"value":"4","text":"Washington"},{"value":"5","text":"Mexico City"},{"value":"6","text":"Buenos Aires"},{"value":"7","text":"Sydney"},{"value":"8","text":"Wellington"},{"value":"9","text":"Canberra"},{"value":"10","text":"Beijing"}]"
But str1 doesnt return above information
When I store same information in .json file then it is accessible with following code
return $.getJSON('assets/cities.json');
But when I am trying to retrieve same info from var str1 it gives following error
Uncaught TypeError: Cannot read property 'toString' of undefined bootstrap-tagsinput.js:226
Uncaught SyntaxError: Unexpected token u