Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

AJAX POST failure

Posted on 2013-05-11
4
Medium Priority
?
446 Views
Last Modified: 2013-05-11
The need is for (1) AJAX POST, (2) cross-domain and (3) issued from one server to another.  To test the code I set up a simple ASP page with the AJAX call to a second page in this case in the same web site.  It fails at line 14 on the AJAX call doing the post, the exception caught at line 18 is error number minus 2147467259, the name of the exception is "Error" with no description or message.  How do I fix this to accomplish my 3 goals?

Calling page
<%@ Language = javascript%>
<%
function ajTrade(keepOn,opt,parm) { 
  var xmlHttp;
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

   xmlHttp.onreadystatechange=function() { processResponse(xmlHttp,opt) }
   var str="opt="+opt;
   for(i=2; i<arguments.length;){
     parm=arguments[i++];
     str+="&p"+(i-2)+"="+escape(parm);
   } 
   try {
     xmlHttp.open("POST",("ajTestReceive.asp"),(keepOn?true:false));
     xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     xmlHttp.send(str);
   }
   catch (e) {
     var aaa=1;
     debugger
   }
}
function processResponse(xmlHttp,opt,txt) {
  if(xmlHttp.readyState==4) {
    if (xmlHttp.status == 200) {
      debugger
      var aaa=1;
    }
    else {
      debugger
      var aaa=1;
    }
  }
}

ajTrade(true,"testStr_1","testStr_2");
%>

Open in new window


receiving page, ajTestReceive.asp
<%@ Language = javascript%>
<!--#include file="iba_serverside.js"-->
<%
  Response.expires=-1;
debugger

  Response.write("");
  Response.End;
%>

Open in new window

0
Comment
Question by:Bob3975
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 34

Expert Comment

by:Slick812
ID: 39158574
greetings  Bob3975, , I can help with your Javascript, But I do not do much with MS  ASP code,

your javascript is just wrong for Ajax
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 39158613
@Slick812, that is Jscript to run on the server, not javascript to run in a browser.  It still might be wrong.  Here's a different version from Microsoft: http://msdn.microsoft.com/en-us/library/windows/desktop/ms766431%28v=vs.85%29.aspx
0
 

Author Closing Comment

by:Bob3975
ID: 39158708
DaveBaldwin, it was the use of Msxml2.ServerXMLHTTP.6.0 that was needed, thx.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39158733
You're welcome, glad to help.
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question