0

サンプルコード:

<html>
    <head>
        .....
    </head>
    <body>
        <div id="content">
            <form>
                ....
                <input type="submit" onclick="loadAnotherPage()"/>
            </form>
        </div>
    </body>
</html>  

divにedit_profile.phpという別のページをロードしたい。contentページを更新せずにそれを達成するにはどうすればよいですか?

jQueryload()メソッドを使ってみました。しかし、私は何かを逃したように見えます。どんな助けでも大歓迎です。

4

3 に答える 3

3

クリックsubmit buttonすると、送信フォームとページの更新が機能しません。

送信設定ボタンを入力してから機能を設定する代わりにonclick

function loadAnotherPage(){
    $("#content").load('edit_profile.php');
}
于 2013-03-21T10:58:41.660 に答える
0
           $(document).ready(
            function() {
              $('#load_file').click(
            $.post('edit_profile.php',
             {},
             function(data){
                $("#content").html(data);
             },''
            )
               ); 
                }
                    );
于 2013-03-21T11:01:27.633 に答える
0

これを試して

<html>
 <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
 </head>
    <body>
     <div id="content"></div>
      <button id="loadpage">load new page</button>
<script>
 $(document).ready(function () {
    $("#loadpage").click(function() {
        $.get("edit_profile.php", function(response){
          $("#content").html(response);
        });
    })
 });
</script>
    </body>
</html> 
于 2013-03-21T11:18:55.123 に答える