[問題] 初碰JQUERY AJAX 麻煩指教一下
目前使用jQuery的ajax,可是卻得不到回傳值。請各位指教一下
在header裡
<script type="text/javascript" src="js/jquery-1.2.6.js"></script>
<script type="text/javascript">
function showMsg(e) {
$(e.target).attr('disabled', true);
$.ajax({
url: 'http://127.0.0.1:8081/KH/forajax.jsp',
error: function(xhr) {
alert('Ajax request 發生錯誤');
},
success: function(response) {
$('#msg').html('demoOK');
}
});
}
function msg2(e){
$('#msg').html('comeFrom2');}
</script>
有個按鈕
<input type="button" value="Click Me" onclick="showMsg()"/>
我的jsp內有
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:out value="demook"></c:out>
第一次使用ajax,卻不知道失敗原因在哪,就取不到回傳值
請各位幫忙看一下 謝謝^^
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.170.127.2
※ 編輯: martone 來自: 118.170.127.2 (10/31 21:31)
推
10/31 22:40, , 1F
10/31 22:40, 1F
→
10/31 22:49, , 2F
10/31 22:49, 2F
→
10/31 22:50, , 3F
10/31 22:50, 3F
推
10/31 22:56, , 4F
10/31 22:56, 4F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章