We help IT Professionals succeed at work.

ajax cross domain

jacobbbc
jacobbbc asked
on


Hello experts,
              Can you please give some working examples using the feature ajax cross domain.
Comment
Watch Question

are you looking for a get request or post request?

Author

Commented:


I am looking for post request
Most Valuable Expert 2011
Top Expert 2016

Commented:
Using it for what, exactly?

Author

Commented:


That allows to perform AJAX requests between different domains
Most Valuable Expert 2011
Top Expert 2016

Commented:
What I'm getting at is the non-technical part of this.  Google Analytics is the complete answer for the way the question is phrased - just do what they do.  

But if we have some understanding of what information you are trying to send between different domains and why you are sending it, we may have other, potentially less brittle suggestions.

Author

Commented:


That is by using ajax I  want to read data from a script in one domain and it should be displayed in another domain.
did you understood the funda used by google analytic?

That is exactly you need to use

Author

Commented:

Can  you  send some links  which describes  the examples for it?
examples are also in that link itself
Most Valuable Expert 2011
Top Expert 2016

Commented:
Sometimes it's all about how you ask the question ;-)
http://lmgtfy.com?q=jQuery+cross+domain+get
Most Valuable Expert 2011
Top Expert 2016

Commented:
As you try to build this out, you may find that you need a two-tier approach.  A security thing called "origin policy" may interfere with direct access to another domain, but you may still be able to achieve the effect you want.  The ajax requests would go to a script on your server.  That script would use an API or would use CURL to read information from the foreign server.  Then the script on your server would reformat the information and respond to the ajax request.

Author

Commented:

I  want to submit a keyword from one of the remote site to a script in another site and the response of the keyword should be displayed in site from which  I sent the  keyword
Web Programmer/Technician
Commented:
I use on-demand javascript for similar situations. Basically, I have a php file in one domain that retrieves data from a mysql database and formats the data in a javascript object or variable with function calls to insert the data on the page. The web page in another domain uses javascript to create a script tag with this php file as the source and dynamically add it to the head tag of that page. When the script tag is added, the javascript it contains is executed.
Most Valuable Expert 2011
Top Expert 2016

Commented:
ID:37249141 exactly describes an API call.  What are the URLs of these sites?  Do you control the server-side scripts on both sites?  Please give us some specifics and we can probably get you accurate answers.
Most Valuable Expert 2011
Top Expert 2016

Commented:
The question said, "give some working examples..."  This smells a lot like one of those questions that had an answer accepted just to get it closed.  No offense to xmediaman, but he describes exactly what Google Analytics demonstrates.  In other words, you already had the answer from gurvinder372 a month ago, and hours before the post you accepted.
Kim WalkerWeb Programmer/Technician

Commented:
No offense taken, Ray_Paseur. If you hadn't just said it, and I hadn't looked at it again, I wouldn't have known I had repeated gurvinder372's comment. I expect the author was overwhelmed with the information there, as was I. But now that you've pointed it out, I'd be happy to relinquish the points to gurvinder372.