Solved

AJAST Cross Domain Request

Posted on 2009-05-16
10
422 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now