onclick on DIV, load content from database on other div

前端 未结 1 1870
夕颜
夕颜 2021-01-28 12:45

My concept is to load contents of a div on other div in html. In short I want to learn how the new Facebook inbox works, when we click on a message on the right, the contents a

1条回答
  •  自闭症患者
    2021-01-28 13:50

    if you are using jquery you can use onclick event on a div.

    This is the HTML/JS this work like this.

    
    
        
            Document Title
            
            
        
        
            
    Click me
    Click me

    and let say we have a PHP file named ajax.php will return a json like we especified before in the ajax function dataType: 'json' and we are sending an ID through POST so here are a example you have to work it on it.

    ajax.php

    ' . $message . '

    '; header('Content-Type: application/json'); echo json_encode( $json ); ?>

    0 讨论(0)
提交回复
热议问题