Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

AJAST Cross Domain Request

Posted on 2009-05-16
10
Medium Priority
?
429 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
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 2000 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

715 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