jQuery/AJAX - Load content into a div when button clicked?

前端 未结 5 1132
野趣味
野趣味 2021-02-09 04:47

Would someone be able to help here?

I would like to fill a div e.g.

with content from an e

5条回答
  •  广开言路
    2021-02-09 05:35

    You could subscribe to the .click() event of the paragraph and then use the .load() function to send an AJAX request to the given url and inject the results into the specified selector:

    $(function() {
        $('.classloader').click(function() {
            $('#contenthere').load('/includes/about-info.html');
            return false;
        });
    });
    

提交回复
热议问题