欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery ajax 局部無刷新更新數(shù)據(jù)的實現(xiàn)案例

 更新時間:2014年02月08日 09:09:58   作者:  
這篇文章主要對jquery ajax 局部無刷新更新數(shù)據(jù)的實現(xiàn)案例進行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助

要更新的頁面

復制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <script src="js/jquery.js" type="text/javascript"></script>

</head>
<body>
    <select id="lucky1" onchange="return duoduo();">
        <option value="1">第一期</option>
        <option value="2">第二期</option>
    </select>
    <div id="duoduo">
        你好</div>
       <input type="text" id="duo"  />
</body>

<script type="text/javascript">

    function duoduo() {
        $.ajax({
            type: 'post', //可選get
            url: 'ajax.aspx', //這里是接收數(shù)據(jù)的程序
            data: 'data=' + $("#lucky1").val(), //傳給PHP的數(shù)據(jù),多個參數(shù)用&連接
            dataType: 'html', //服務器返回的數(shù)據(jù)類型 可選XML ,Json jsonp script html text等
            success: function(msg) {
                //這里是ajax提交成功后,程序返回的數(shù)據(jù)處理函數(shù)。msg是返回的數(shù)據(jù),數(shù)據(jù)類型在dataType參數(shù)里定義!
                document.getElementByIdx_x_x("duoduo").innerHTML = msg;
                //$("#duoduo").innerHTML = msg;
            },
            error: function() {
                alert('對不起失敗了');
            }
        })
    }

</script>

</html>


操作頁面
復制代碼 代碼如下:

  protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Params["data"].ToString().Equals("1"))
        {
            Response.Write("<a href=\"http://www.baidu.com\">第一期</a>");
        }
        else if (Request.Params["data"].ToString().Equals("2"))
        {
            Response.Write("<a href=\"http://www.baidu.com\">第2期</a>");
        }
    }

相關(guān)文章

最新評論