Parse/Get HTML title element from a PHP file for an Ajax cal

I am trying to get the title element’s content that is contained in a echo statement of a PHP file.I am using a PHP file for a website that when accessed by a Ajax call it returns only part of the page, but when accessed directly it returns the entire page.That much is working fine. But I …

via HTML Language Development » Search Results » ajax:

Parse/Get HTML title element from a PHP file for an Ajax cal

I am trying to get the title element’s content that is contained in a echo statement of a PHP file.
I am using a PHP file for a website that when accessed by a Ajax call it returns only part of the page, but when accessed directly it returns the entire page.
That much is working fine. But I would like to change the title of the page when it is accessed via the Ajax call, the innerHTML of the title tag is what I’m trying to get.
if (empty($_SERVER[‘HTTP_X_REQUESTED_WITH’]) == ‘xmlhttprequest’) {
echo ‘

With a HTML file this code works.

if(isset($_GET[‘url’])) {
$url = $_GET[‘url’];
$html = file_get_html($url);
/* get page’s title */
preg_match(“/
Then, from index.php:
$page_title = “INSERT THE PAGE TITLE HERE”;
require “ajax_page.php”;

For more info: Parse/Get HTML title element from a PHP file for an Ajax cal

HTML Language Development » Search Results » ajax

Parse/Get HTML title element from a PHP file for an Ajax cal

Share this post:

Related Posts

Leave a Comment