Solved

status 122 error - AJAX call through ASP.NET for IE 7

Posted on 2010-09-22
6
810 Views
Last Modified: 2012-05-11
I am getting the "Status is 122" error when I am making the AJAX call and using the  browser IE7. Everything works fine in case I use the browser IE6. The related code is in the code section. Please guide me to the right direction.


function SaveMktMessagingInfo() 
    {           
        var ddlItemSelected=document.getElementById('<% =ddlProductCategory.ClientID%>');
        var i = ddlItemSelected.selectedIndex;
        var selectedProductCategory_value = ddlItemSelected.options[i].value;
        var selectedProductCategory_text = ddlItemSelected.options[i].text;
        
        var ddlHandheldSelected=document.getElementById('<% =ddlHandheld.ClientID%>');
        i = ddlHandheldSelected.selectedIndex;
        var selectedHandheld_value = ddlHandheldSelected.options[i].value;
        var selectedHandheld_text = ddlHandheldSelected.options[i].text;
        
        var Ctl_txtProductOverview = document.getElementById('<% =txtProductOverview.ClientID%>');
        var Ctl_txtKeySellingPoints = document.getElementById('<% =txtKeySellingPoints.ClientID%>');
        
        var HiddenHMktMessageOrig=document.getElementById('<% =HMktMessageOrig.ClientID %>');
        var HiddenHKeySellPtOrig=document.getElementById('<% =HKeySellPtOrig.ClientID %>');
        alert(HiddenHMktMessageOrig.value);
        
        var url = "AjaxDBConnectHandler.ashx?rnd=" + Math.random() + "&DataReturned=" + escape("MktMessSave") + "&HHID=" + escape(selectedHandheld_value) + "&ProdCategID=" + escape(selectedProductCategory_value) + "&MktMessageText=" + escape(Ctl_txtProductOverview.innerHTML) + "&KeySellingPointsText=" + escape(Ctl_txtKeySellingPoints.innerHTML) + "&MktMessageOrigText=" + escape(HiddenHMktMessageOrig.value) + "&KeySellingPointsOrigText=" + escape(HiddenHKeySellPtOrig.value);
        
        receiveReq.abort();
        receiveReq.open("POST", url, true);

        receiveReq.onreadystatechange = Save;
        receiveReq.send(null);
    }

function Save() 
    {   
             
        if (receiveReq.readyState == 4) 
        {
            if (receiveReq.status == 200) 
            {
                response = receiveReq.responseText;

                if(response=="True")
                    alert("Saved Successfully");
                else
                    alert(response);
            }
            else
                alert("status is " + receiveReq.status);
        }
    }

Open in new window

0
Comment
Question by:skaleem1
[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
  • 3
  • 3
6 Comments
 
LVL 10

Expert Comment

by:TiberiuGal
ID: 33736489
Hi,
you might have the problem detail here:
http://www.codebelay.com/blog/2008/09/05/the-http-status-122-error-in-ie7-in-ajax-apps/

have a look, post back if this doesn't work for you.

0
 
LVL 1

Author Comment

by:skaleem1
ID: 33736511
TiberiuGal:

Please look at my code. I already am using the Post method and still not working for IE7. For IE6, it works.
0
 
LVL 10

Expert Comment

by:TiberiuGal
ID: 33736784
The problem is related to ie7
http://www.lorem.biz/http-status-codes.asp

You do "POST", but you are dynamically building your URL query string which is "GET" and perhaps could get longer than 2033 chars,
please check your resulting "url" variable's length.


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:skaleem1
ID: 33736910
Yes the size of the url is more than 2033 characters. So what is the work around?
0
 
LVL 10

Accepted Solution

by:
TiberiuGal earned 500 total points
ID: 33741286
Hi,

you send your data using the send method like this



var url = "AjaxDBConnectHandler.ashx";

receiveReq.open("POST", url, true);
receiveReq.onreadystatechange = Save;

receiveReq.send("&rnd=" + Math.random() + "&DataReturned=" + escape("MktMessSave") + "&HHID=" + escape(selectedHandheld_value) + "&ProdCategID=" + escape(selectedProductCategory_value) + "&MktMessageText=" + escape(Ctl_txtProductOverview.innerHTML) + "&KeySellingPointsText=" + escape(Ctl_txtKeySellingPoints.innerHTML) + "&MktMessageOrigText=" + escape(HiddenHMktMessageOrig.value) + "&KeySellingPointsOrigText=" + escape(HiddenHKeySellPtOrig.value);
        );

Open in new window

0
 
LVL 1

Author Closing Comment

by:skaleem1
ID: 33753725
Thanks a lot TiberiuGal
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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…

740 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