1

I'm trying to get the results of a search page with an ajax ansync get

$.get('http://www.dmv.org/ca-california/auto-insurance-results.php?zip=90210', function (data) {

    var results = $('.ZD_9_Middlefull_centerno_blue_bar .ZD_9_Middlefull_centerno_blue_bar', $(data));
    results = results.html();
    console.log(results);

});

is works great everywhere (ie10, ie8, chrome, safari) except ie9 and firefox. In these two browsers The page is returned but with no results. I'm pretty new to ajax so at a bit of a loss on what to try next.

any ideas are greatly appreciated

(ps: yes that selector is weird it's my only choice)

kidwon
  • 4,448
  • 5
  • 28
  • 45
digital-pollution
  • 1,054
  • 7
  • 15
  • Do you have extensions etc. in those two browsers? – hjpotter92 Jul 03 '14 at 02:09
  • only firebug and firephp in firefox, vanilla install of ie. Since the rest of the page returns it's full html except the results i'm guessing it's some kind of completing the request before the results are in issue? – digital-pollution Jul 03 '14 at 02:14

1 Answers1

0

You cannot make an ajax call to different origin. You should use curl in your backend to make this type of calls.

XMLHttpRequest cannot load http://www.dmv.org/ca-california/auto-insurance-results.php?zip=90210&_=1404353517803. Origin http://stackoverflow.com is not allowed by Access-Control-Allow-Origin.

Rafal
  • 2,576
  • 2
  • 18
  • 13
  • And here is the full explanation `http://stackoverflow.com/questions/10143093/origin-is-not-allowed-by-access-control-allow-origin` – Rafal Jul 03 '14 at 02:17
  • thanks for the comment. I am running this code from the host site. if you paste this code in from the console on that domain it should work (everywhere but ie9 and firefox) – digital-pollution Jul 03 '14 at 02:17
  • Thnkas for confirming Rafal. I got it working in an incognito window too. Looks like more of a speed issue on the clients site. Thanks for the keen eye – digital-pollution Jul 03 '14 at 02:32