Solved

window.open causing ajax problems

Posted on 2014-03-24
1
506 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how can i gnupg encrypt a PDF document? 12 28
How would I do a website like this? 5 54
Jquery 10 19
Javascript Form Change 5 16
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

774 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