function readMemory(ptr, size)
{
$.post("readMemory.php", { ptr : ptr, size : size}, function(data)
{
});
//return "data"
}
Hi, I just want to get data variable as return of readMemory function. Is there any proper way to do this?
The best thing to do is use a callback:
(Note that we have
ptrandsizebeing passed tocallbackas well asdata; this is usually good practice.)So code you were expecting to use
readMemorylike this:…will instead look like this:
This is because your
readMemoryfunction only starts thePOSToperation; it returns before the operation completes (the operation is asynchronous).