I have a script that query a database and echo out a json code with the results.
The javascript takes that and store in a variable using jQuery.parseJSON method then populates a text box to do an autocomplete.
Everything works perfect if I return less than 30 rows on the database query.
It looks that jQuery.parseJSON method fails when I passed to it more data.
There is any possible change that I can increment the value to allow it to parse more data ?
Thank you for all your help.
JSON Code.
{
"display":true,
"url":"http://project-url",
"autoComplete":
[
{
"value":"1",
"desc":"Ford",
"model":"Edge",
"label":"1 Ford Edge"
},
{
"value":"2",
"desc":"Toyota",
"model":"Camry",
"label":"2 Toyota Camry"
},
{
"value":"3",
"desc":"Honda",
"model":"Accord",
"label":"3 Honda Accord"
},
{
"value":"4",
"desc":"Honda",
"model":"Civic",
"label":"4 Honda Civic"
}
]
}
Javascript Code.
var data = $.parseJSON(jsonVar);
$('#value-input').autocomplete(
{
source: data.autoComplete,
minLength: 3,
select: function(event, ui)
{
$('#desc-input').val(ui.item.desc);
}
});
Aucun commentaire:
Enregistrer un commentaire