Executing [removed] injected by innerHTML after AJAX call

前端 未结 11 1791
误落风尘
误落风尘 2020-11-22 05:02

There\'s a div called \"Content\":

It should be filled with data from a PHP file, by AJAX, including

11条回答
  •  深忆病人
    2020-11-22 05:37

    I had a similiar post here, addEventListener load on ajax load WITHOUT jquery

    How I solved it was to insert calls to functions within my stateChange function. The page I had setup was 3 buttons that would load 3 different pages into the contentArea. Because I had to know which button was being pressed to load page 1, 2 or 3, I could easily use if/else statements to determine which page is being loaded and then which function to run. What I was trying to do was register different button listeners that would only work when the specific page was loaded because of element IDs..

    so...

    if (page1 is being loaded, pageload = 1) run function registerListeners1

    then the same for page 2 or 3.

提交回复
热议问题