I'm using an ajax request to send in ids and get information from my database to populate a table. Here's the client side:
userLookup: function (callBack, idList) {
var data;
data = { 'idList': idList};
var url = "/idLookup";
$.ajax({
type: 'GET',
url: url,
data: data,
dataType: 'json',
success: function (data) {
callBack(data);
}
});
}
And the server side starts like this:
module.exports = function (app) {
app.get('/idLookup', function (req, res) {
....
The idList variable is a comma-seperated list of ids. When there are only 10 or so it works find, but when I get to about 50-100 I get a "404 - File not Found" error. Anyone know why this is, and how I can fix it?
I think there must be a limit on what you can pass into the 'data' parameter in a GET request. I did this and it works now.
userLookup: function (callBack, idList) {
var data;
//data = { 'idList': idList};
var url = "/idLookup?idList=" + idList;
$.ajax({
type: 'GET',
url: url,
//data: data,
dataType: 'json',
success: function (data) {
callBack(data);
}
});
}