Welcome Guest, Not a member yet? Register   Sign In
Jquery ajax success function returns null?
#16

[eluser]BrianJM[/eluser]
[quote author="explorercode" date="1296120240"]Thank you so much... I see the site working on your server... very nice..
now... what is the code on brianjm_._com/explorercode/proxy.php
how did you create the proxy.php? can you send me the code for it?
sorry, I am new to codeignter if the proxy is common knowledge.. thx[/quote]

Attempting to retrieve the output of a page on your domain, from my domain, is cross site scripting (it would fail for this reason alone). To provide a working example I created proxy.php which retrieves the response from the URL you provided me. You should not have to use this, it does not come with CI, and I don't recommend using it; again, I only used proxy.php to be able to use your live data in my working example.

You should be able to use the JavaScript in the source I provided, on your domain, replacing 'proxy.php' with your URL, and it should work. If it does not then there is something else wrong here.

Are you violating the Same Origin Policy? Data cannot come from another server, another port, or another protocol ("http:" vs "https:" vs "file:") than the current page.

Give the code a try to let us know what the result is.

Here is proxy.php (because you asked):
Code:
<?php
// Set your return content type
header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/json');

// Website url to open
$url = 'YOUR_URL_GOES_HERE';

// Get that website's content
$h = fopen($url, "r");

// If there is something, read and return
if ($h) {
    while (!feof($h)) {
        $buffer = fgets($h, 4096);
        echo $buffer;
    }
    fclose($h);
}
?>


Messages In This Thread
Jquery ajax success function returns null? - by El Forum - 04-06-2010, 05:01 AM
Jquery ajax success function returns null? - by El Forum - 04-06-2010, 06:05 AM
Jquery ajax success function returns null? - by El Forum - 01-25-2011, 05:02 PM
Jquery ajax success function returns null? - by El Forum - 01-25-2011, 09:43 PM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 02:40 AM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 07:12 AM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 07:16 AM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 01:37 PM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 05:39 PM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 06:41 PM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 08:03 PM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 08:05 PM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 08:31 PM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 08:56 PM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 09:24 PM
Jquery ajax success function returns null? - by El Forum - 01-26-2011, 10:14 PM
Jquery ajax success function returns null? - by El Forum - 01-27-2011, 02:08 PM
Jquery ajax success function returns null? - by El Forum - 01-27-2011, 03:09 PM
Jquery ajax success function returns null? - by El Forum - 01-27-2011, 03:25 PM
Jquery ajax success function returns null? - by El Forum - 01-27-2011, 03:38 PM
Jquery ajax success function returns null? - by El Forum - 01-27-2011, 03:41 PM
Jquery ajax success function returns null? - by El Forum - 01-27-2011, 04:23 PM
Jquery ajax success function returns null? - by El Forum - 01-27-2011, 08:23 PM
Jquery ajax success function returns null? - by El Forum - 01-27-2011, 10:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB