Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I write AJAX within an ASP page?

Status
Not open for further replies.

nooreo

Programmer
Apr 4, 2016
1
MY
Can I do something like this? I am not sure if I can because it is giving me an invalid character error.





[pre]
function c

.....
set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP") 'MSXML2.ServerXMLHTTP.6.0
httpRequest.Open "POST", APIURL, False ' false means asynchronous'
httpRequest.setRequestHeader "content-type", "application/x-httpRequest.Send checkRatesArray
postResponse = httpRequest.ResponseText
set httpRequest=Nothing

response.Write postResponse

redirect(postResponse)

end function

function redirecting(thisOne)


$.ajax({
type: "POST",
url: "../easyparcel/decodeTrial.asp",
data: JSON.stringify({postResponse}),
contentType: "application/json; charset=utf-8",
dataType: thisOne,
task:"checkRates",
success: function (msg) {

window.open("MultiLineTitleForAnchor.aspx");
}
});

end function
[/pre]
I am trying to send a json object between two asp files. Any idea how to do this?
 
The ajax code has to be written in either an external .js file or in a <script> block on the aspx page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top