ajax未调用到后台的action
页面源码没错,action的URL也没问题,直接在浏览器中调用该acion可正确执行。
但用ajax却无法调用,请大侠指导啊!!谢谢!!
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<script type="text/javascript">
function queryCertificateID(){
alert("开始查询证件类型!");
$.ajax({
type: "GET",
url: "<%=basePath%>/basebiz/queryCertificateTypeAction!queryCertificateType",
success:function(data){
alert("查询证件类型成功!");
},
error: function(){
alert("查询证件类型失败!");
}
});
}
</script>
<body onload="queryCertificateID()">
<form id="form1" name="form1" method="post" action="">
<table width="300" border="0" align="center">
<tr>
<td width="114">手机号码</td>
<td width="176"><label>
<input type="text" name="user.userPhone" />
</label></td>
</tr>
<tr>
<td>电子邮箱</td>
<td><input type="text" name="user.userMail" /></td>
</tr>
<tr>
<td>姓 名</td>