Hello, there is a code:

  var url = "http://steamcommunity.com/id/foozzylalka";
 $ .get (url, function (data) {

   var hide = $ ('. persona_level', data) .size ();

     if (hide> 0) {

         var cs_go = $ ('div.game_info_cap a', data) .attr ('href'). split ('/') [4];

         if (cs_go == "730") {

             / * accept *

         } else {/ * block * /}

     } else {/ * block * /}

   $ ('# wrapper'). html (cs_go);

 }); 

So, where / * accept * /, I need to somehow click on the button.

Picture (image): D

With the tab open, I did it through document:

document.getElementsByClassName('btn_profile_action:first').click();

And how to implement it through the request?

    3 answers 3

    Maybe you

     $('selector').click(); 

    will help

    • Not. Because I simply get the page code in the data variable. Those. I have to trigger an event on another page. - Slavik Okara
    • one
      First you need to embed the code in the DOM, and then try to simulate the event. - Alexey Lemesh
    • The fact of the matter is that I do not know how to do it. Can you tell me? - Slavik Okara 9:01 pm
    • $ ('# wrapper'). html (cs_go); before event imitation - Alexey Lemesh 8:13 pm

    $('selector').toggle(); - This is an imitation of pressing a button.

      Solved the problem differently. The function sent data to a php file via ajax. So I just copied my ajax request and substituted the necessary parameters.