[jQuery] Re: Read/Get Data From Other URL
You can't do xhr-requests from subdomains (or other 3'rd party
domains), it's a browser restriction.
You can however achieve the same effect by some neat tricks.
Here is a good page that explains this well
You can also use jQuery to fetch JSON from other domains by ajax, but
that's another story.
/ Johan
On 25 Dec, 03:46, Pram <acep.sudra...@gmail.com> wrote:
> I try use the jquery, but I have a problem.
>
> 1. I save jquery.js in the root (examplewww.mysite.com) and in the
> bottom of jquery.js file I add this script:
>
> $(document).ready(function(){
> $.get("http://www.mysite.com/data.php", { SearchFormName:
> BalizonSearchFormName, dt: cnt }, function(data){
> $('#adv').html(data);
>
> });
> });
>
> 2. FIle data.php has simple script like this:
> <?php echo "Ajax Tested Only" ?>
>
> 3. And in the file .php (example: test.php) on the root, I have script
> like this to show result from data.php:
>
> <div id="adv"></div>
> <script type="text/javascript">
> .....
> .....
> </script>
> <script type="text/javascript" src="http://www.mysite.com/jquery.js"></
> script>
>
> So, if run this test.php file from the root (www.mysite.com)
> successfully (show result). But if I run the test.php from sub domain
> or another my web (different url) can't show the result (blank).
>
> Can someone to help me, please?
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home