update wordpress site url

this method is to update wordpress site url after you have move/migrate your wordpress server.
open functions.php in the template/themes folder you are using. /saacommy/v2/wp-content/themes/ (if you can’t find functions.php in your template folder, create it.
then add the following line, after

update_option('siteurl','http://new_domain_name/');
update_option('home','http://new_domain_name/');

remove it after it’s updated in your admin.

detect ajax request in php

this only works if your server support HTTP_X_REQUESTED_WITH

if ( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ) {
//ajax action here.
}

run php code inside html

create .htaccess file, and add the following line:
what if the cdn service for your jquery is down? you may need a fallback to load your local jquery.js file.

AddType application/x-httpd-php .html .htm

you may create .htaccess file in windows explorer with the following method:
1. right click on folder -> new -> text document
2. rename the filename to .htaccess. (note there is a dot at the back)
3. press enter and it will be renamed to .htaccess by windows itself.

jquery cdn fallback

what if the cdn service for your jquery is down? you may need a fallback to load your local jquery.js file.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>!window.jQuery && document.write('<script src="http://code.jquery.com/jquery-1.4.2.min.js"><\/script>');</script>