Lead Me

Lead me not into temptations,
I can find the way myself
Guide me to where truth is mentioned,
While lies falls to the ear of the deaf.

Lead me into the world
of perfection,
On faces of every boy and girl,
Present no disappointment.

Lead me into glory,
Which reached through honesty,
Not abiding the devil’s game,
For that will bring me shame.

You always see my doings,
And You are always listening,
I’m begging to you Lord Almighty,
Please lead me.

*Italic lines were quoted from Rita Mae Brown

Continue reading “Lead Me” »

[PHP 5 + jQuery]: JSON Cross Domain

Here I will share how we can get data from another domain. Normally this will return an error as it’s involving cross domain, requested by one domain to another domain. This tutorial will be using PHP 5 along with jQuery.

First, let’s look at the source of the PHP file, (file name: process.php):

 * @author Mohd Rashidi Bin Mohd Zin ([email protected])

$text = $_GET['text'];
$callback = $_GET['callback'];

if (!empty($text))
        case 'Google':
            $return = 'The Oracle';

        case 'Yahoo!':
            $return = 'Morpheus';

        case 'MSN':
            $return = 'Mr Smith';

            $return = 'Who the heck?';

    echo $callback.'('.json_encode(array("result" => $return)).')';

This is the file which will store on a different domain. As you can see, the file accepts two inputs; user’s input and name of the callback function. It is important to mention name of the callback function, otherwise Firefox will return an error “invalid label”, while other browser will not display anything.

In the end, the file will return a string consists of name of the callback function and the encoded JSON.

Continue reading “[PHP 5 + jQuery]: JSON Cross Domain” »