ajax

来源:互联网 发布:网络安全检查总结报告 编辑:程序博客网 时间:2024/05/23 20:41
function goajax(gourl,divid)
{
var postStr = "" ;
 
$.ajax(
            {
            type: "POST",
            contentType: "application/x-www-form-urlencoded" ,
            url: gourl,
            data: postStr,
            error: function(){
                        alert( '您所请求的页面有异常,请刷新重试。' );
                        },
            success: function(msg){
                                     
                             if(msg=="" ){
                                                   $("#"+divid).html("没有结果" );
                 
                                     }
                                    
                             else{
                                      
                                                            $( "#"+divid).html(msg);
                     if(divid=="city" )
                   {
                        $( "#county").html("<option value='0'>选 择</option>" );
                   }
                                     }
                         }
            });
}          
  

第二种方法
var AjaxURL = "/user/getVerifyCode";
        $.ajax({
            type: "POST",
            dataType: "html",
            url: AjaxURL,
            data: {username: username},
            error: function () {
                alert('error');
            },
            success: function (data) {
                alert(data);
            }
        });
0 0
原创粉丝点击