Solved

AJAST Cross Domain Request

Posted on 2009-05-16
10
423 Views
Last Modified: 2012-05-07
Starting with the sample AJAST demo located here:
http://ajast.org/ajast/ajast_demo.html 
I copy the source to my local web server and it works great.  But when I edit the source to try to GET a remote file from any other web server it fails with the message :
404: Requested resource cannot be accessed at this time.   I can't figure out what I am doing wrong.

Any suggestions would be greatly appreciated.

Thanks,
Curt
 

0
Comment
Question by:97WideGlide
  • 5
  • 5
10 Comments
 
LVL 2

Expert Comment

by:IndianHero2001
ID: 24405803
What remote file you requested? Please paste URL.
0
 
LVL 8

Author Comment

by:97WideGlide
ID: 24406304
To answer your question.  I cannot get the demo program to go to ANY webpage other than the ones specified in the demo.  I even created simple php and html files on the same server and get the error above.  Shouldn't I just be able to put any other web location in and get the page?

Maybe AJAST isn't what I should be using.  Here's what I am trying to do...

I'm playing a web based game and have written some simple javascript to analyze my current game situation.  I want my local page to load my current game settings from the remote game site each time so that I don't have to bring up a separate browser, go to my game page and manually fill in my form.   The game is Kingdomgame.net and the file I am trying to load is overview.asp.  

But, just to get things going I tried to make it as simple as possible by going to several other websites to see if I could just get the first word or so of their main page.  I also created html and asp files on my own server which just displayed the word 'welcome' to see if that could be loaded and got the same error.

   
0
 
LVL 2

Expert Comment

by:IndianHero2001
ID: 24407342
Ok, what you are trying to do is, trying to load overview.asp from a remote server using that AJAST.

Thats not going to work by simply replacing the URL with your own because thats not how its going to work.

What AJAST does is it inserts a dynamic javascript in your document. And, this javascript url is basically your overview.asp?your=abc&params=here.

So, AJAST is basically a Javascript hack to get around cross-site call security limitation of browsers.

To answer your question, you need to modify ajast.js a little bit based on your requirements and also write your own overview.asp to respond to the query.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 2

Expert Comment

by:IndianHero2001
ID: 24407410
To elaborate more, the response from overview.asp is a Javascript code (which contains your game settings).

And, this javascript code is then executed so your game-page updates accordingly.
0
 
LVL 8

Author Comment

by:97WideGlide
ID: 24407537
I'm wondering if I explained myself well enough cause I'm still confused.  

At kingdomgame.net I have an account and when I login and browse to overview.asp I get a page which roughly resembles the following:

Networth: 25,546
Land:  27,893 acres
Lumber: 273,012
Stone: 45,234
...
...
...

I have written a web page in HTML/javascript which resides on my web server and spits out some results based on the parameters from kingdomgame.net/overview.asp.  It works fine but I currently have to go to kingdomgame and manually view the state of my account and key the parameters into my local page for processing.  I would like to be able to click a button on my local page and have it fetch the parameters automatically and insert them in my form under program control.

Does this make sense ?  Is AJAST what I want to be using here?  If I can't get it to work then I will just make a Java application which scrapes the data I need and processes it.  

I don't want to beat this dead horse too much so if we don't get it this time around, I'll just award points and move on.

Thanks,
Curt
 
0
 
LVL 2

Expert Comment

by:IndianHero2001
ID: 24407561
Scraping suits well for your requirement. It will be faster to implement and less pain.
0
 
LVL 8

Author Comment

by:97WideGlide
ID: 24407749
That's a last resort but I'd like to keep it web enabled if at all possible.
0
 
LVL 2

Accepted Solution

by:
IndianHero2001 earned 500 total points
ID: 24407931
AJAST won't work in your situation because it requires you to have control on remote server.

But what you require can be done with Jquery. Plus, you add one page on your server which does "scraping" work.

You use JQuery to load results from this back-end page. This call is made using AJAX(JQuery).

The page in your back-end will accept parameters(from querystring) and will scrap the page on remote GameServer. Then, you can update game state on your page with these results from AJAX call.
0
 
LVL 8

Author Comment

by:97WideGlide
ID: 24408006
Thank you.  I think that answers my question here.  I'll give it a try and if I have problems, I'll open up another question.
0
 
LVL 8

Author Closing Comment

by:97WideGlide
ID: 31582310
Thanks again.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question