Solved

window.open causing ajax problems

Posted on 2014-03-24
1
494 Views
Last Modified: 2014-03-24
hi,

I have the following line of code:

$.ajax({url:"case.php",type:"post"});

window.open("test.php","_self");

The case.php assigns a value to a session variable, it works perfect until I add the window.open statement, then the ajax statement stop working. Any idea?
0
Comment
Question by:joyacv2
1 Comment
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39950884
Because the ajax is asynchronous ergo you are changing the url before it is finished

Change your code to
$.ajax({ url: "case.php",type:"post"}).done(function () {
    window.open("test.php","_self");
})

Open in new window

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now