Gocha Kereselidze Gocha Kereselidze - 5 months ago 10
Javascript Question

Parse information from external dynamically loaded js file

I have attached external js file which one changes on every visit.
this is my file.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script async="" src="//xx.example.net/checkInventory.php?_=&amp;v=3&amp;siteId=1059123&amp;minBid=0&amp;popundersPerIP=0&amp;blockedCountries=&amp;documentRef=&amp;s=1600,900,1,1600,900" type="text/javascript"></script>


this is response when i type this xx.example.net/..... link in my browser :

window._pao.parse({ 'result': 1, 'url': 'http://example.com/', 'bla': 'bla', 'bla': 1 });

I want to simply parse this url in my code.How can i handle this problem?


Based on the limited info you provided here is my best guess at what you want:

    window._pao = {}
    window._pao.parse = function (object){ // Declare the window._pao.parse function in order to capture  the object
        // Here object = { 'result': 1, 'url': 'http://example.com/', 'bla': 'bla', 'bla': 1 }
        // Do stuff with object here
<script src="path/to/your/external/js/file.js"></script>