Javascript Browser GET Request

I need to request a client page on a web page and pass it to the server as a string. I tried jQuery:

$.get(
    "http://example.ru/",
    {name:"Joe", age:"42"},
    function(data){
        $.get(
            "script.php",
            {data:data, query:query},
        )
    });
});

but failed. I suspect this failed due to custom headers added by jQuery.

Can you advise me on any technique to override request headers or any js library that makes requests just like a browser?

+3
source share
1 answer

You have been caught the same origin policy :

script, .

, - , ( , ), ajax. :

$.get("yourdomain/proxy.php?name=Joe&age=42"
    function(data){
        $.get(
            "script.php",
            {data:data, query:query},
        )
    });
});
+3

Source: https://habr.com/ru/post/1720900/


All Articles