I have this code
in one page, that sends the form info to GetPptInfo.asp, which *should* (or so I thought) run the code and send the result back to the calling page. Instead it stays on GetPptInfo.asp:
The code works, it does everything that I have asked it to EXCEPT making this call ala AJAX and simply updating the div on the calling page, it displays my response.write, but it stays on GetPptInfo.asp. I would like it t return that response.write info to the calling page (pptinfo.asp) and update a div on that page. Help?
Willie
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html>
<head>
<title>Proof of Concept PR3327</title>
<script type="text/javascript" src="[URL unfurl="true"]https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>[/URL]
<script type="text/javascript">
$(function () {
$("#frm-send").submit(function () {
$, get("GetPptInfo.asp", function (data) {
$(".result");
alert("it worked");
});
return false; // don't let the form be submitted
});
});
</script>
</head>
<body>
<form name="GetPptInfo" action="GetPptInfo.asp" method="POST">
Enter ppt id: <input type="text" id="pptid" name="pptid" />
<input type="submit" value="submit" />
</form>
<div id="txtHint">Customer info will be listed here...</div>
</body>
</html>
in one page, that sends the form info to GetPptInfo.asp, which *should* (or so I thought) run the code and send the result back to the calling page. Instead it stays on GetPptInfo.asp:
Code:
<%Option Explicit%>
<!-- #include file="../../lib/out.inc" -->
<!-- #include file="../../lib/liHead.inc" -->
<%
'response.ContentType="text/HTML"
'response.Charset="ISO-8859-1"
dim pptid : pptid = request("pptid")
session("dataEntrySiteID")=left(pptid,3)
on error resume next
dim pptsql : pptSQL = "SELECT coalesce(CONVERT(int,formversion),0) as formversion FROM dbEDRN316.dbo.vwMaxConsentFormVersion where study_participant_id='"&pptid&"'"
dim rs1 : rs1 = RunWithRS(pptsql)
if rs1("formversion")=0 then
response.write("this is not a valid participant id, please try again.")
else
dim irbsql : irbsql = "SELECT max(LEFT(version,1) ) as formversion FROM [NewCompass].[dbo].[tblProtocolSiteIRBInfo] where protocolID="&session("selected[s][/s]protocolid")&"and deleteflag=0 and siteid="&session("dataentrysiteid")
dim rs2 : rs2 = RunWithRS(irbsql)
if err <> 0 then
response.write(err.description)
response.write("<br>Damn it Jim, I am a doctor, not a magician!")
else
if rs2("formversion") > rs1("formversion") then
response.write("There is a newer IRB approved version of the forms. Has particpant "&pptid&" reconsented for version "&rs2("formversion")&"?")
else
response.write("Its all good, no worries")
end if
set rs1=nothing
set rs2=nothing
rs1.close
rs2.close
end if
end if
on error goto 0
%>
The code works, it does everything that I have asked it to EXCEPT making this call ala AJAX and simply updating the div on the calling page, it displays my response.write, but it stays on GetPptInfo.asp. I would like it t return that response.write info to the calling page (pptinfo.asp) and update a div on that page. Help?
Willie