-
Notifications
You must be signed in to change notification settings - Fork 300
Description
Client have a ajax call , just like:
post_data = "keyword=" + keyword.value;
$.ajax({
type:"POST",
url:"TooltipSearch",
data:post_data,
dataType:'json',
success:function(data)
{
console.log(data)
}
});
Server /TooltipSearch like:
app.post('/TooltipSearch', function(req, res){
var Tooltip_param = '{"Keyword": "'+ req.body.keyword +'"}';
var search = require('./build/Release/florida');
var data = JSON.parse(search.v8access(16, Tooltip_param));
if (data.length > 0) {
console.log(data);
result = {result:1,content:data};
}
else {
result = {result:0, error_msg:'no data!'};
}
res.contentType('json');
res.json(result);
});
the TooltipSearch get data is Average 1.3 seconds
but, when i try to call multi ajax call at the same time e.g. 5 times ,
ajax isn't async process , about 6.5 seconds after the last ajax call get response.
Can anyone tell me why this? And how to adjust node js to make ajax normal asynchronous processing. thank you very much~