Reputation: 275
I have 2 web pages
On my index page I have a form which calls my second page which contains php and javascript etc.
Is it possible to keep the index page showing until the second page has loaded after the form has been submitted? or something that will achieve a similar result.
Many thanks
Upvotes: 0
Views: 48
Reputation: 1792
You can use jquery's .post
function for this.
https://api.jquery.com/jQuery.post/
Example:
$.post( "test.php", { name: "John", time: "2pm" })
.done(function( data ) {
alert( "Data Loaded: " + data );
});
You can use .html
to display the data https://api.jquery.com/html/.
Note: You can't run the js from test.php on the main page. If you want to achieve this. A solution is to include the javascript on the mainpage instead of the second page.
Upvotes: 1