0

Hi have done a lot of searching and can only find custom functions so far to try and tackle this problem so wondering if any other way exists.

I have the following html stored in a variable.

        <li><span class="a-list-item">
            <a href="/gp/aag/details/ref=olp_merch_ship_5?ie=UTF8&amp;asin=B00OYTAM&amp;seller=A3O5PMH9ZRRJ&amp;sshmPath=shipping-rates#aag_shipping">Domestic delivery rates</a>
                 and <a href="/gp/aag/details/ref=olp_merch_return_5?ie=UTF8&amp;asin=B00OYTAM&amp;seller=A3O5PMH9ZRRJ&amp;sshmPath=returns#aag_returns">return policy</a>.
        </span></li>

and using the following, im able to access the second url.

abc = $(this).find('span[class="a-list-item"] a[href*="aag_returns"]').attr('href');

however what i am wanting to do next is then get a specific value of a parameter "seller", am i able to do this, by simply adding, changing the above statement, or do i need additional code, and if so, is there anything that will parse it.

edit used the following provided function, with slight alteration to pass url.

function getQueryVariable(url,variable) {
       var query = url;
       var vars = query.split("&");
       for (var i=0;i<vars.length;i++) {
               var pair = vars[i].split("=");
               if(pair[0] == variable){return pair[1];}
       }
       return(false);
};

0 Answers0