6

How to get content from another page without loading in the browser

 2 years ago
source link: https://www.codesd.com/item/how-to-get-content-from-another-page-without-loading-in-the-browser.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to get content from another page without loading in the browser

advertisements

Context:
There is an asp page in another web site that contains a search form. After submitting this form with the search value, the page displays the results of the search in an iframe.

Question:
I want to use the returned result in my page without loading that page in browser. I have got permission from the other web site administrator. I know php and jQuery. How should I proceed?

Example:
abcd.asp contains a form which contains <input name="regno"/> and a submit button. The form submits to itself and results Name, date of birth and Marks is returned in table format in an iframe.

Notes:
I have a page with same <input> and upon submitting it will use the above asp page and get details and display it in my page.


Easiest way:

  1. Use jQuery to submit your page via AJAX to a local PHP file.
  2. When the local PHP file gets the request, do a curl post request to your remote page and fetch the results.
  3. Return these results in your local PHP script so that these will be available to your AJAX request
  4. Your ajax request now has the remote contents, so just use jQuery to push them into the document.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK