If xml.drugstore.com is not the page that your Javascript is located
on, it's not going to work. You cannot use AJAX (XMLHTTPRequest) to
make cross-domain requests. If xml.drugstore.com is not your domain,
you're going to have to use another method. One recommended way is to
use a proxy script. For example, you have a PHP script on your server
that fetches the XML content form xml.drugstore.com and you call that
PHP script with $.get. Since the PHP script is on your server, you
should be able to call with without cross-domain issues.

On Jun 16, 1:34 pm, MattN <mtec...@yahoo.com> wrote:
> I'm having trouble using remote xml feeds. In this example, I'm trying
> to get product id's from drugstore.com's xml feed. Looking at my
> console log in Firebug... my get function isn't working.
>
> <script type="text/javascript">
>
> $(function(){
>    $.get('http://xml.drugstore.com/xml.asp?
> c=10&b=&k=&SORT=&filter=&type=topsellers&trx=xml&trxp1=10&f=xml', {},
> function(xml) {
>       console.log('successfully got xml feed');
>       $('Details',xml).each(function(i){
>          productID = $(this).find('ProductID').text();
>          console.log(productID);
>       });
>    });
>
> });
>
> </script>

Reply via email to