Current location: Hot Scripts Forums » General Web Coding » JavaScript » Cross Domain AJAX AKA OnDemand JavaScript


Cross Domain AJAX AKA OnDemand JavaScript

Reply
  #1 (permalink)  
Old 11-17-11, 03:05 AM
islamoc islamoc is offline
New Member
 
Join Date: Nov 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Hazard Cross Domain AJAX AKA OnDemand JavaScript

I Have this script
PHP Code:

/* AJAX functions. */

function createRequest(){ 
var 
xmlhttp false;
 try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
catch(
e){try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
catch(
E){xmlhttp false;}}
 if(!
xmlhttp && typeof XMLHttpRequest!='undefined')
{try{
xmlhttp = new XMLHttpRequest();}
catch(
e){xmlhttp=false;}}
 if(!
xmlhttp && window.createRequest){try{xmlhttp window.createRequest();}
catch(
e){xmlhttp=false;}}
 return 
xmlhttp; }
function 
move_file(url){
 var 
con=createRequest();
 
con.open("GET",url,true);
 
con.onreadystatechange=function() {
  if(
con.readyState==&& con.status==200)  
{   
alert("File successfully moved.");   }  } 
con.send(null); } 
I will save this JS on my server let s call it movf.js
Then I want to run this from a diffrent server
PHP Code:

<html>

<head>
<script src="http://www.myserver.com/movf.js></script>
</head>
<body>
<?phpecho "<script> move_file('http://www.myserver.com/test/move_file.php');</script>";>
</
body>
</
html>
this 2nd script I want to run it on an other server
but because of the same origin security policy in javascript I can t run it
I have found 2 SOLUTION :
The 1st one is to use a proxy server som how and I don t want to do that
The 2nd one is by using JSON Cross Domain AJAX AKA OnDemand JavaScript - Reimers.dk
But I could not unterstand how can I do it I mean Programme it.
Please Any one can help me to prgramme this part
Please I need help as soon as possible
-----------------------------------------------------------------------------------
Mennouchi Islam Azeddine
Porject Manager of ADZ project
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross domain scripting in Opera. Is it possible? Shto JavaScript 0 05-18-09 08:19 AM
Cross (trusted) domain scripting Thunderbunny ASP 2 05-31-08 02:48 PM
domain check ramez Script Requests 8 03-06-04 11:26 PM


All times are GMT -5. The time now is 02:08 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.