Jquery load url with ajax

前端 未结 3 2032
北恋
北恋 2021-01-26 10:13

I\'m trying to automatically run an ajax url when my page is fully loaded using .load() function. It seems my code doesn\'t work.

Other information:

<
3条回答
  •  我在风中等你
    2021-01-26 10:42

    This is completely working but just shows this error:

    XMLHttpRequest cannot load https://shareasale.com/sale.cfm?amount=99.00&tracking=15&transtype=sale&merchantID=49748. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.

    This might not work from yout local host but will work properly from any server.

    And still there is any error try this code:

    $(document).ready(function(){
        $.ajax({
               url:'https://shareasale.com/sale.cfm?amount=99.00&tracking=15&transtype=sale&merchantID=49748',
               success:function(data)
                {
                    alert(data);
                }
            })
    });
    

提交回复
热议问题