0

I have two pages in different server.

Through ajax I would like to include some data: here is an example: link

The link is working through browser.

jQuery(window).ready(function() { getPageWithAjax("http://www.betcatcher.com/index.php?page=valuebets&nr_row=6"); function getPageWithAjax(page) { //alert(page) ajaxRequest = $.ajax( { url: page, cache: false, success: function(msg){ajaxResponse(msg)}, error: function(msg){ajaxResponse('Error loading data.'+msg.status)} }); } function ajaxResponse(msg) { $("#live_bet_ajax_content").html(msg); } }); 

But I'm getting error when I'm trying to get data.

4
  • use firefox + firebug, and using the net tab you should be able to see what's wrong there. Commented Dec 4, 2011 at 11:48
  • Yes, I'm also using firebug, but I couldn't figure out what the problem is. Commented Dec 4, 2011 at 11:52
  • is the requested url in the same domain that you send the request? Commented Dec 4, 2011 at 11:53
  • "I'm getting error". could you actually POST that error here? Commented Dec 4, 2011 at 12:00

2 Answers 2

3

I assume, that you call script from different domain. You should use JSONP which supports cross-domain calls. Read this article how to do this.

Sign up to request clarification or add additional context in comments.

Comments

0

looks to me like a Same-Origin Policy problem. For new browsers you could enable Cross-Origin Resource Sharing (CORS) http://enable-cors.org/ for old browser you probably need to build a serverside proxy which rewrites the requests.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.