Solved

Multiple Ajax calls

Posted on 2013-01-28
6
234 Views
Last Modified: 2013-02-01
Hi all,

I have a php page that calls another page using this code...

xmlhttp.open("GET","login.php",false);
xmlhttp.send();
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;

Open in new window


...what I'd like to do is call another page using variable value info returned from this page.

Thanks.
0
Comment
Question by:j789
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 38830639
You can do that.  What is the question?

You would probably be better off using jQuery instead of trying to write the AJAX calls yourself.  Cross-browser, standard framework, etc.  jQuery has many advantages.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38830935
take a look to the pages attached
getvarinpage.html
login.php
0
 
LVL 34

Expert Comment

by:Slick812
ID: 38831474
greetings   j789;  You get this back from the login.php ajax retrieve - xmlhttp.responseText , To take out the Text section of this string that has the "variable value" you want (a URL I guess) , , you will need to go through the  xmlhttp.response  Text and detect and separate the URL out of it. But you do not say what might be in this  xmlhttp.response for us to help you do that.
There are some better ways to get variables from returned ajax strings, using some other ways to set-up your ajax PHP script return to browser ajax.
please Ask questions if you need more information about this.
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

Author Comment

by:j789
ID: 38841541
Hi Ray_Paseur, can you please provide an example or link? Thanks
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 250 total points
ID: 38844288
I have a "hello world" example of jQuery/AJAX in this article.  Maybe you could extend that concept to make another GET or POST request.
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/A_10712-The-Hello-World-Exercise-with-jQuery-and-PHP.html
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 250 total points
ID: 38844302
ID: 38830935 have complete working codes...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

695 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