On Aug 20, 11:53 am, ak732 wrote:
> Just be aware that doing the ajax call synchronously will block (lock
> up) the browser until the request/response completes. This is
> typically okay when running locally, but can be very noticeable when
> running on slower connections (e.g. shared hosting)
Just be aware that doing the ajax call synchronously will block (lock
up) the browser until the request/response completes. This is
typically okay when running locally, but can be very noticeable when
running on slower connections (e.g. shared hosting). There's no
reason why you cannot do this a
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 + ')');
the code i posted should have no problem working as long as it is used
properly... without seeing your actual HTML and where stuff is and
what gets called, it's impossible to help completely. and the
/ thing won't matter that much as long as document.ready
is used... but even that's a guess
and just to note
success = SaveSearch_Success,
should look just like that...
it shouldn't be
success = SaveSearch_Success(),
or
success = SaveSearch_Success(data),
or *anything else*... it already "knows" to pass the resultant JSON
to the function
On Aug 20, 9:34 am, dkomo872
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 + ')');
Try doing this and see if it works:
#msg_div {font-color:red;}
$.post('save_search.php', formData, function(data) {
jsonData = eval('(' + data + ')');
if (jsonData.return_status.search("successful") > -1) {
$('#msg_div').html("Search was saved");
} else {
$('#msg_div').html("Search
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
"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 + ')');
the script isn't back from the post call yet
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 is called from within
your callback method.
e.g.
v
>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 recognized globally. Check
http://docs.jquery.c
12 matches
Mail list logo