Reputation:
I have to read information as below from a microprocessor hardware
var save_it = '';
$.ajax({
type: "GET",
url: 'http://www.micro-processor-server/?ROBOT=arm_controle',
async: false,
success:function(m) {
save_it = m;
}
}).responseText;
console.log(save_it);
While doing so, it works, but my browser console gives very scary warning as below, also several times I have noticed web-browser Google chrome get hang:
Can anyone please show an alternative way how to make my Ajax query compatible? (I can't change codes in Micro-processor its third party robot)
Upvotes: 0
Views: 172
Reputation:
call another function with return data.
$.get('http://www.micro-processor-server/? ROBOT=arm_controle',function(data){
myfun(data);
});
myfun(data){
console.log(data);//here you might be able get rid of asynchronous behaviour.
}
Upvotes: 0
Reputation: 33466
Put the code that needs the response in the success
function. You could also use $.get
if this is all you're needing to do.
$.get('http://www.micro-processor-server/?ROBOT=arm_controle', function(data) {
console.log(data);
});
Upvotes: 1