he right solution, and I can still keep Ajax requests
asynchronous.
> On Aug 20, 1:13 pm, dkomo872 wrote:
>
> > On Aug 20, 6:59 am, MorningZ wrote:
>
> > > "Does anyone know what is wrong? I've never seen an ordinary function
> > > behave this way. &q
On Aug 20, 6:59 am, MorningZ wrote:
> "Does anyone know what is wrong? I've never seen an ordinary function
> behave this way. "
>
> That's because $.post (and the resultant $.ajax) isn't "ordinary",
> it's an asynchronous call and when you hit the line
>
> jsonData = eval('(' + data + ')');
On Aug 20, 6:26 am, Chrazy wrote:
> From the looks of it, why don't you use the $.ajax function and do
> your stuff on success? Seems like an easier way to structure things.
>
> Sometimes a variable used in a function that you want to use elsewhere
> has to be stored somewhere as it won't be re
On Aug 20, 6:59 am, MorningZ wrote:
> "Does anyone know what is wrong? I've never seen an ordinary function
> behave this way. "
>
> That's because $.post (and the resultant $.ajax) isn't "ordinary",
> it's an asynchronous call and when you hit the line
>
> jsonData = eval('(' + data + ')');
On Aug 20, 7:01 am, Leonard Martin wrote:
> The trouble is that the $.post is run asynchronously so anything after
> the $.post will be executed before the callback function.
>
> If you want the returned data to be available outside the callback
> then it will have to be inside a function which
I have Javascript code that looks like this:
var data1;
$.post('save_search.php', formData, function(data) {
data1 = data;
} );
jsonData = eval('(' + data1 + ')');
if (jsonData.return_status.search("successful") > -1)
$('#msg_div').html("Search was saved
6 matches
Mail list logo