Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1306
  • Last Modified:

XMLHTTPRequest Help

Hi All

  this may be a tough one, but here goes. I am using the XMLHTTPRequest object in IE/Netscape. We purchased some controls that we really love but cant seem to get them to work with the XMLHTTPRequest object. The Control is the Webcombo by Intersoftpt.com. I am Using a GET method of the XMLHTTPRequest object. I can get all of the ASPX page but the Webcombo returns with backslashes escaping double quotes they use in their client side calls. They have no solution as they do not support the XMLHTTPRequest object. as an example here is what the return is( comprised of XML structured data):
   <wcrs='onSelectedItem(\"controlname\")'><wcrsUpdate='onLostFocus(\"controlName\")'>
the problem is the \". I have tried to use a Regular Expression replace i.e. str.replace('\\"/g','\"') but to no avail as it seems to replace everything as it was when i started. i can replace everything with a single quote, but that doesnt help much where the client side methods are concerned because of the formatting of the client side methods of the control.
  How can i force the XMLHTTPRequest object to ignore double quotes or use Regular Expression replace? to replace all occurences of a backslash and a double quote with just a double quote?
0
theMightyThor1212
Asked:
theMightyThor1212
  • 17
  • 9
  • 7
  • +1
2 Solutions
 
ZvonkoSystems architectCommented:
Your RegExp does not look good.
Try this:

str.replace(/\\"/g,'"');

0
 
theMightyThor1212Author Commented:
Zvonko,

  I have used that but figured i 'd give your example a try, but that seems to have no effect. I still find the \" in the HTML just as it was when the responsetext was returned. I can't figure out why i can't replace the \" with that simple Expression.

  thanks for your time.

Here is my Code:
function js_RemoveChar(str)
{
//str Returned is response text of XMLHTTPRequest Object
var test="";
charToRemove = '/\\"';
regExp = new RegExp(charToRemove,"g");
test = str.replace(regExp, '"');

}

I thought it looked good, then reality set in.
0
 
amit_gCommented:
Try it this way ...

<script>
function js_RemoveChar(str)
{
//str Returned is response text of XMLHTTPRequest Object
var test="";
charToRemove = /\\"/g;
regExp = new RegExp(charToRemove);
test = str.replace(regExp, '"');
alert(str + "\n" + test);
}

// Following lines only to test the RegExp
var str = "<wcrs='onSelectedItem(\\\"controlname\\\")'><wcrsUpdate='onLostFocus(\\\"controlName\\\")'>";
js_RemoveChar(str);

</script>
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ZvonkoSystems architectCommented:
Either you do that like this:

<script>
function js_RemoveChar(str)
{
//str Returned is response text of XMLHTTPRequest Object
var test="";
charToRemove = '\\\\"';
regExp = new RegExp(charToRemove,"g");
test = str.replace(regExp, '"');
alert(test);
}
</script>
<textarea onBlur="js_RemoveChar(this.value)" cols=80 rows=20>
</textarea>


Or like I proposed in my first comment:
<script>
function js_RemoveChar(str)
{
//str Returned is response text of XMLHTTPRequest Object
var test = str.replace(/\\"/g,'"');
alert(test);
}
</script>
<textarea onBlur="js_RemoveChar(this.value)" cols=80 rows=20>
</textarea>

0
 
theMightyThor1212Author Commented:
Hi Thanks for your response. Maybe this will clarify:

The XMLHTTPRequest Object does a GET from this File as it appears Below:

            <td class="Bxoutline" align="Center"><style type="text/css"><!--
<span id='ddlUserName_main' class='wcFrame' clsOff='wcFrame' clsOver='wcFrameOver' clsDown='wcFrame' style='width:200px;; ' onmouseover='wcov("ddlUserName")' onmouseout='wcot("ddlUserName")'><nobr><input id='ddlUserName_text' align='absmiddle' autocomplete='off' value="NONE" type="text" tabIndex='2' class='wcTextBox' clsOff='wcTextBox' clsOver='wcTextBoxOver' clsDown='wcTextBox' style='width:180px;float: left;padding-left: 3px; padding-top: 3px; height: 18px ' onfocus="wcf('ddlUserName')" onblur="wcb('ddlUserName')" onkeydown="wckd('ddlUserName')" onkeyup="wcku('ddlUserName')" errName="LaunchOp" req="true"><span hideFocus id='ddlUserName_search' class='wcSearchSpan' clsOff='wcSearchSpan' clsOver='wcSearchSpanOver' clsDown='wcSearchSpan' style='width:16px;text-align: center;float:right; ' onmousedown="wcrs('ddlUserName', true)">6</span></nobr></span><input type='hidden' ISCtl=true id='ddlUserName' name='ddlUserName' value=''><script language='JScript'>wci('ddlUserName');wciv("ddlUserName", "NONE", "0");wcupdpd("ddlUserName");</script></td>

After Get into str Variable it looks like this:
            <td class=\"Bxoutline\" align=\"Center\"><style type=\"text/css\"><!--
<span id='ddlUserName_main' class='wcFrame' clsOff='wcFrame' clsOver='wcFrameOver' clsDown='wcFrame' style='width:200px;; ' onmouseover='wcov(\"ddlUserName\")' onmouseout='wcot(\"ddlUserName\")'><nobr><input id='ddlUserName_text' align='absmiddle' autocomplete='off' value=\"NONE\" type=\"text\" tabIndex='2' class='wcTextBox' clsOff='wcTextBox' clsOver='wcTextBoxOver' clsDown='wcTextBox' style='width:180px;float: left;padding-left: 3px; padding-top: 3px; height: 18px ' onfocus=\"wcf('ddlUserName')\" onblur=\"wcb('ddlUserName')\" onkeydown=\"wckd('ddlUserName')\" onkeyup=\"wcku('ddlUserName')\" errName=\"LaunchOp\" req=\"true\"><span hideFocus id='ddlUserName_search' class='wcSearchSpan' clsOff='wcSearchSpan' clsOver='wcSearchSpanOver' clsDown='wcSearchSpan' style='width:16px;text-align: center;float:right; ' onmousedown=\"wcrs('ddlUserName', true)\">6</span></nobr></span><input type='hidden' ISCtl=true id='ddlUserName' name='ddlUserName' value=''><script language='JScript'>wci('ddlUserName');wciv(\"ddlUserName\", \"NONE\", \"0\");wcupdpd(\"ddlUserName\");</script></td>

After Regex replace it still appears the same on the Page Out put and the control does not function, this is an onload call and has to be that way. the purposes of loading the page in this manner is to use the XMLHTTPRequest Object to navigate pages in a site to give it a Windows Like appearance on the Intranet. this is a Web App.
I do appreciate your patience and responses. I would have been the first Person to say your answers were correct because that is what i thought the answer was, but either it is the XMLHTTPRequest Object or Javascript itself that is escaping the Double Quote. I dont know which it is but i would sure like to to find out.

Again, thanks immensely for your patience. Let me know if you find out anything else.
0
 
ZvonkoSystems architectCommented:
What do you mean with anything else?

Does this not work for you:

<script>
function js_RemoveChar(str)
{
alert(str)
//str Returned is response text of XMLHTTPRequest Object
var test = str.replace(/\\"/g,'"');
alert(test);
}
</script>
<textarea onBlur="js_RemoveChar(this.value)" cols=80 rows=20>
<td class=\"Bxoutline\" align=\"Center\"><style type=\"text/css\"><!--
<span id='ddlUserName_main' class='wcFrame' clsOff='wcFrame' clsOver='wcFrameOver' clsDown='wcFrame' style='width:200px;; ' onmouseover='wcov(\"ddlUserName\")' onmouseout='wcot(\"ddlUserName\")'><nobr><input id='ddlUserName_text' align='absmiddle' autocomplete='off' value=\"NONE\" type=\"text\" tabIndex='2' class='wcTextBox' clsOff='wcTextBox' clsOver='wcTextBoxOver' clsDown='wcTextBox' style='width:180px;float: left;padding-left: 3px; padding-top: 3px; height: 18px ' onfocus=\"wcf('ddlUserName')\" onblur=\"wcb('ddlUserName')\" onkeydown=\"wckd('ddlUserName')\" onkeyup=\"wcku('ddlUserName')\" errName=\"LaunchOp\" req=\"true\"><span hideFocus id='ddlUserName_search' class='wcSearchSpan' clsOff='wcSearchSpan' clsOver='wcSearchSpanOver' clsDown='wcSearchSpan' style='width:16px;text-align: center;float:right; ' onmousedown=\"wcrs('ddlUserName', true)\">6</span></nobr></span><input type='hidden' ISCtl=true id='ddlUserName' name='ddlUserName' value=''><script language='JScript'>wci('ddlUserName');wciv(\"ddlUserName\", \"NONE\", \"0\");wcupdpd(\"ddlUserName\");</script></td>
</textarea>

Put the cursor inside the textarea.
After bluring out the cursor you will see that all backslashes are gone.

0
 
theMightyThor1212Author Commented:
No This does not work for me. The regex Has to Occur before rendering of the page, it cannot occur after page load nor can it occur in a Text box. I could do the same thing all day in a text box and it works just fine, but that is not what is required.

The Backslash Has to be removed when the ResponseText of the XMLHTTPRequest Object returns it so the page can render it as the innerHTML of a DIV tag.

thanks
0
 
ZvonkoSystems architectCommented:
And why do you think there is a difference betwean changing the value of a textarea and the text value in the responseText before you assign it to the div's innerHTML? It is the same String replace method.

0
 
theMightyThor1212Author Commented:
Because it doesnt work stripping the responsetext versus a textarea, the Textarea is available after page render, the DIV innerHTML is only available before rendering. The Regex propably works however either the XMLHTTPRequest Object escapes the Double quote or it is Javascrupt escaping them. I have Successfully replace the responsetext with Single Quotes and had it render on the page properly but the clientside methods of the control need to have both single and double quotes in that call to it's methods. that's what is messing me up. I have to have the Control and it's content come across as if a Normal page navigation occurred. Put the HTML i posted here on a page, do a XMLHTTPRequest.open("GET",URL,true) and try and regex the responsetext, you will see what i mean. you can use any objects in the HTML you do a GET on and it will return the same.

  Maybe this question is more a Javascript Syntax question than a Regex Question.
0
 
ZvonkoSystems architectCommented:
Before we go on to discuss your problem please understand that a String value is a String value.
I used textarea to demonstrate that a String value is same as you enter it in textarea.
Now you confuse yourself telling something about rendering. Don't you believe that the function var str gets the same value as you type in the textarea? And if you found that this is correct conclusion, then why do you doubt that responseText value will be differnet handled by a String function then any other String var?

Now you tell me your \" are not replaced by my RegExp to "
I believe you view some rendered html after the RegExp replacement wich renders the html back to escaped quota representation.

0
 
theMightyThor1212Author Commented:
I Fully understand a string value is a string value. I realize that the textarea represents that perfectly.

  I am not confusing my self with rendering or pre-rendering. i assure you i know the difference. i can only tell you that if i place the str variable into a textarea then run a client side function that replaces the \" with " it works great after Rendering. If you do your replace function prior to rendering or pre-render, you would see your textarea containing the \" as if you never ran the regex replace. Please try it out, return some html using double quotes and use your replace to change the string value and replace \".

  I am as confused by this as you are. the Regex should run just fine during the processing of the string before it is rendered to the page. the Fact is, it doesnt seem to have any effect on the string.

  Is this something to do with the javascript engine or the XMLHTTPRequest Object that maybe we are missing? Is it normal for the Javascript engine to escape double quotes in this manner when javascript works with strings? Or is this something to do with the XMLHTTPRequest Object? does it think all double quotes need to be escaped before returning out put to the page.

I also assure you you can duplicate this behavior with ease using any HTML that contains Double Quotes. make a sample page, put a couple of buttons on it, make sure it is all enclosed in Double quoted function, i.e <input type="button" id="me" value="Click ME" onClick="click.this"> Process this through an XMLHTTPRequest.open("GET",URL,true) , send the responsetext to your Regex Function and look at the returning string. you will see what i am getting.

Sorry this is so confusing, but i like you fully expected a string value to be a String value.
0
 
ZvonkoSystems architectCommented:
JavaScript does no string value conversion by itself.
Anyway, at some point your backslashes come into the strings and we can find the poit where they occure again.
So what do you see when you alert() the responseText after receiving it and before the RegExp replacement and after the replacement? Do you see all the time the backslashes? Also watch out for html entities like: &quot; or &#34;
0
 
theMightyThor1212Author Commented:
thanks for having the patience with this. On the Alert, it all looks fine, no slashes. Once returned to the innerHTML, then rendered in the DIV tag, slashes are back.
0
 
ZvonkoSystems architectCommented:
In what browser brand and version?
0
 
theMightyThor1212Author Commented:
IE 6
0
 
ZvonkoSystems architectCommented:
Look for the difference betwean the buggy version and the version with the replace() method:

<html>
<head>
<script>
function showHTML(str){
  alert(str)
  var theDiv = document.getElementById("someDiv");
  theDiv.innerHTML = str //.replace(/\\"/g,'"');
  alert(theDiv.innerHTML);
}
</script>
</head>
<body>
<form>
<textarea onBlur="showHTML(this.value)" cols=80 rows=20>
<table><tr>
<td class=\"Bxoutline\" align=\"Center\">
<span id='ddlUserName_main' class='wcFrame' clsOff='wcFrame' clsOver='wcFrameOver' clsDown='wcFrame' style='width:200px;; ' onmouseover='wcov(\"ddlUserName\")' onmouseout='wcot(\"ddlUserName\")'><nobr><input id='ddlUserName_text' align='absmiddle' autocomplete='off' value=\"NONE\" type=\"text\" tabIndex='2' class='wcTextBox' clsOff='wcTextBox' clsOver='wcTextBoxOver' clsDown='wcTextBox' style='width:180px;float: left;padding-left: 3px; padding-top: 3px; height: 18px ' onfocus=\"wcf('ddlUserName')\" onblur=\"wcb('ddlUserName')\" onkeydown=\"wckd('ddlUserName')\" onkeyup=\"wcku('ddlUserName')\" errName=\"LaunchOp\" req=\"true\"><span hideFocus id='ddlUserName_search' class='wcSearchSpan' clsOff='wcSearchSpan' clsOver='wcSearchSpanOver' clsDown='wcSearchSpan' style='width:16px;text-align: center;float:right; ' onmousedown=\"wcrs('ddlUserName', true)\">6</span></nobr></span><input type='hidden' ISCtl=true id='ddlUserName' name='ddlUserName' value=''><script language='JScript'>wci('ddlUserName');wciv(\"ddlUserName\", \"NONE\", \"0\");wcupdpd(\"ddlUserName\");</script></td>
</tr></table>
</textarea>
</form>
<div id="someDiv"></div>
</body>
</html>

0
 
b1xml2Commented:
you can use an XSLT document to restyle/transform your XML. The output can be HTML, XML or as I suspect in your case Text.
0
 
theMightyThor1212Author Commented:
No it has to be html, but i do thank you for your suggestion. I'll have to see if i can work up an XSLT example some where and apply it to the page.
0
 
b1xml2Commented:
hope you do find a resolution =)
0
 
amit_gCommented:
Could you post a sample page with the problem? I don't think anyone understood by what you mean by before rendering. I tried to reproduce your problem and I could not see those \" either in JavaScript alert or by adding the response to a innerHTML of a Div.
0
 
theMightyThor1212Author Commented:
This is what is returned from the replace function.  In the Alert Box it looks nothing like this, but the backslash is an escape variable in an alert box so i dontthing it would show up anyway. this is the HTML that is Loaded into the Innerhtml. Thanks for your time

Replace Statement = test.replace(/\\"/g,'"')
Return:(below)
<script language=\"javascript\">
            //var Un = wcGetComboById(\"ddlUserName\");
            
var btnClicked = '';
var frmType = '';

function setForm(){
switch (frmType){

    case \"Add\":
        var cmdbtnAdd = document.getElementById(\"cmdAdd\");
        cmdbtnAdd.style.display='block';
        var cmdbtnUpd = document.getElementById(\"cmdUpdate\");
        cmdbtnUpd.style.display='none';
        var cmdbtnDel = document.getElementById(\"cmdDelete\");
        cmdbtnDel.style.display='none';
        var Un = wcGetComboById(\"ddlUserName\");
        //Un.FrameObj.style.display='block';
        Un.TextObj.focus();
        break;
       
case \"Delete\":
        var cmdbtnAdd = document.getElementById(\"cmdAdd\");
        cmdbtnAdd.style.display='none';
        var cmdbtnAdd = document.getElementById(\"cmdUpdate\");
        cmdbtnAdd.style.display='none';
        var cmdbtnDel = document.getElementById(\"cmdDelete\");
        cmdbtnDel.style.display='block';
        var Un = wcGetComboById(\"ddlUserName\");
        //Un.FrameObj.style.display='none';
        Un.TextObj.focus();
            var intLocation = document.getElementsByName(\"drs_choiceCLHL\");

            for (i = 0; i< intLocation.length;i++)
            {
                intLocation[i].disabled=true;
            }
            i=0;
        break;

     }
}
function DRS_AddMgr(){
var intLocation = document.getElementsByName(\"drs_choiceCLHL\");
var intSelectedLoc = 0;

for (i = 0; i< intLocation.length;i++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
            if (intLocation[i].checked){
                  intSelectedLoc = intLocation[i].value;
            }
}
i=0;

            if (validate()){
                        var intRtn = 0;
                        var strUsrChk = \"\";

                var Un = wcGetComboById(\"ddlUserName\");


                        DRS_AdminMethods.DRS_AddMgr(Un.Value,intSelectedLoc,fnctCallBack);
                        ResetWebcombo('ddlUserName');
            }
var combo = wc_States['ddlUserName'];
combo.TextObj.focus();

}

function DRS_DeleteMgr(){
var Un = wcGetComboById(\"ddlUserName\");
            if (Al.Text != \"NONE\"){
                        DRS_AdminMethods.DRS_DeleteMgr(Un.Value,fnctCallBack);
                        ResetWebcombo('ddlLaunchOp');
            }else{
                        alert(\"Please Select an Manager.\");
            }
var combo = wc_States['ddlUserName'];
combo.TextObj.focus();


}
function fnctCallBack(response){
var strRtnMsg = document.getElementById(\"statmsg\");
strRtnMsg.style.visibility=\"visible\";

   if (response.error != null){  
      alert(response.error.message);
     
   }
    strRtnMsg.innerHTML = \"Manager Updated. \"+response.value;
   
}

            </script>

            <form name=\"Form1\" method=\"post\" action=\"TestContainer.aspx\" id=\"Form1\">
<input type=\"hidden\" name=\"__EVENTTARGET\" value=\"\" />
<input type=\"hidden\" name=\"__EVENTARGUMENT\" value=\"\" />
<input type=\"hidden\" name=\"__VIEWSTATE\" value=\"dDw4Njc5NzEwNzg7dDw7bDxpPDA+Oz47bDx0PDtsPGk8MT47PjtsPHQ8O2w8aTwyPjs+O2w8dDw7bDxpPDA+Oz47bDx0PDtsPGk8MD47PjtsPHQ8QDA8bnRsb2dpbjtFTUFJTDs7OztvPHQ+O288dD47MDtwPDtwPGw8ZXJyTmFtZTtyZXE7PjtsPExhdW5jaE9wO3RydWU7Pj4+O0AwPEVNQUlMA1RydWUDA1RleHQDA0VtYWlsA0ZhbHNlA0VtYWlsAzADMjAwcHg7RnVsbF9OYW1lA1RydWUDA1RleHQDA0Z1bGwgTmFtZQNGYWxzZQNGdWxsX05hbWUDMQMyMDBweDtudGxvZ2luA1RydWUDA1RleHQDA050TG9naW4DRmFsc2UDbnRsb2dpbgMyAzBweDs+O0lTTmV0LldlYlVJLldlYkNvbWJvLk1vZGUsIElTTmV0LldlYlVJLldlYkNvbWJvLCBWZXJzaW9uPTIuMC4yNTAwLjMyLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWM0MTg0ZWYwZDMyNjM1NGI8TXVsdGlwbGVDb2x1bW5zPjtJU05ldC5XZWJVSS5XZWJDb21iby5FbnRyeU1vZGUsIElTTmV0LldlYlVJLldlYkNvbWJvLCBWZXJzaW9uPTIuMC4yNTAwLjMyLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWM0MTg0ZWYwZDMyNjM1NGI8QXV0b0NvbXBsZXRlPjs+Ozs+Oz4+Oz4+Oz4+Oz4+Oz4+O2w8ZGRsVXNlck5hbWU7Pj68ltd3qdzWuIvU+FeX+cxvbM69HA==\" />

<script language=\"javascript\" type=\"text/javascript\">
<!--
      function __doPostBack(eventTarget, eventArgument) {
            var theform;
            if (window.navigator.appName.toLowerCase().indexOf(\"microsoft\") > -1) {
                  theform = document.Form1;
            }
            else {
                  theform = document.forms[\"Form1\"];
            }
            theform.__EVENTTARGET.value = eventTarget.split(\"$\").join(\":\");
            theform.__EVENTARGUMENT.value = eventArgument;
            theform.submit();
      }
// -->
</script>
<script language='JavaScript'>var is_CurPage = '/AtlasVAdmin/TestContainer.aspx';</script>

      <script language='JScript.Encode' src='/CommonLibrary/WebCombo2/WebCombo.jse'></script>


                  <table id=\"tbl_DRSGroup\" border=\"0\" style=\"width:940px;\">
      <tr class=\"hdrRow\">
            <td align=\"Right\" colspan=\"2\">
                                    <a href='javascript:void(0);' onMouseover='popInfo(this,true);' onMouseout='popInfo(this)'>
                                          <font color='SteelBlue' face='tahoma' size='2'><b>Help</b></font><IMG src='images/HelpIcons/icon5.gif' border='0'></a></td>
      </tr><tr class=\"hdrRow\">
            <td class=\"hdr\" align=\"Center\" colspan=\"2\">Manager</td>
      </tr><tr class=\"hdrRow\">
            <td class=\"Bxoutline\" align=\"Center\"><style type=\"text/css\"><!--

--></style><xml id='ddlUserName_xml'><isnet.webui.webcombo><uniqueid>ddlUserName</uniqueid><allowautopostback>False</allowautopostback><allowaqh>True</allowaqh><allownavigationonmousewheel>True</allownavigationonmousewheel><combomode>MultipleColumns</combomode><alwaysshowhelpbutton>True</alwaysshowhelpbutton><addfilters></addfilters><alwaysshowresultbox>False</alwaysshowresultbox><alwaysshowcolumnheaders>True</alwaysshowcolumnheaders><statusboxposition>Top</statusboxposition><helpimage>wc_help16.gif</helpimage><dropdownrows>50</dropdownrows><autoload>True</autoload><latency>500</latency><datavaluefield>ntlogin</datavaluefield><datatextfield>EMAIL</datatextfield><minChars>0</minChars><entryMode>AutoComplete</entryMode><imagesfolder>/CommonLibrary/Images/</imagesfolder><adjustrbtop>0</adjustrbtop><adjustrbleft>0</adjustrbleft><resultBoxWidth>0</resultBoxWidth><resultBoxHeight>200</resultBoxHeight><hasDataSource>True</hasDataSource><hasRows>True</hasRows><statusBoxVisible>True</statusBoxVisible><allowAdd>True</allowAdd><textboxMode>Editable</textboxMode><boundMode>AutoDetect</boundMode><styles><resultframestyle className='wcResultFrame'></resultframestyle><resultboxstyle className='wcResultBox'></resultboxstyle><statusboxstyle className='wcStatusBox'></statusboxstyle><rowstyle className='wcRow'></rowstyle><headerstyle className='wcHeader'></headerstyle><columnstyle className='wcColumn'></columnstyle><selectedrowstyle className='wcSelectedRow'></selectedrowstyle><morebuttonstyle className='wcMore'></morebuttonstyle><morebuttonoverstyle className='wcMoreOver'></morebuttonoverstyle><events><onbeforerequest></onbeforerequest><onresponse></onresponse><onbeforeitemselected></onbeforeitemselected><onafteritemselected></onafteritemselected><onerror></onerror><onlostfocus></onlostfocus><onadditem></onadditem><onunhandlederror></onunhandlederror><oninitialize></oninitialize><onmatchinstantlookup></onmatchinstantlookup></events><texts><loading>Loading...</loading><help>Help</help><more>More records.</more><noresults>No results found.</noresults><retrieved>{retrieved} of {totalrows} retrieved.</retrieved><search>Search for</search></texts></styles><columns count='3'><column width='200px' headerText='Email' fieldName='EMAIL'></column><column width='200px' headerText='Full Name' fieldName='Full_Name'></column><column width='0px' headerText='NtLogin' fieldName='ntlogin'></column></columns><totalretrievedrows>0</totalretrievedrows><totalrows>-1</totalrows><lastddr>0</lastddr></isnet.webui.webcombo></xml>
<span id='ddlUserName_main' class='wcFrame' clsOff='wcFrame' clsOver='wcFrameOver' clsDown='wcFrame' style='width:200px;; ' onmouseover='wcov(\"ddlUserName\")' onmouseout='wcot(\"ddlUserName\")'><nobr><input id='ddlUserName_text' align='absmiddle' autocomplete='off' value=\"NONE\" type=\"text\" tabIndex='2' class='wcTextBox' clsOff='wcTextBox' clsOver='wcTextBoxOver' clsDown='wcTextBox' style='width:180px;float: left;padding-left: 3px; padding-top: 3px; height: 18px ' onfocus=\"wcf('ddlUserName')\" onblur=\"wcb('ddlUserName')\" onkeydown=\"wckd('ddlUserName')\" onkeyup=\"wcku('ddlUserName')\" errName=\"LaunchOp\" req=\"true\"><span hideFocus id='ddlUserName_search' class='wcSearchSpan' clsOff='wcSearchSpan' clsOver='wcSearchSpanOver' clsDown='wcSearchSpan' style='width:16px;text-align: center;float:right; ' onmousedown=\"wcrs('ddlUserName', true)\">6</span></nobr></span><input type='hidden' ISCtl=true id='ddlUserName' name='ddlUserName' value=''><script language='JScript'>wci('ddlUserName');wciv(\"ddlUserName\", \"NONE\", \"0\");wcupdpd(\"ddlUserName\");</script></td><td class=\"Bxoutline\" align=\"Center\">
                                          <input type=radio name='drs_choiceCLHL' Value='1' checked ID='Radio1'>Cape
                                          <input type=radio name='drs_choiceCLHL' Value='2' ID='Radio2'>Vandenberg
                                          <input type=radio name='drs_choiceCLHL' Value='3' ID='Radio3'>Denver
                              </td>
      </tr><tr>
            <td align=\"Center\" colspan=\"2\">
                                    <INPUT type='button' id='cmdAdd' value='   Add   ' title='Add this user to the DRS Application.'
                                          OnClick='DRS_AddUser();' TabIndex='19' NAME='cmdAdd'><INPUT type='button' id='cmdUpdate' value='Update' title='Update this DR Users information.'
                                          OnClick='DRS_UpdateUser();' TabIndex='20' NAME='cmdUpdate'><INPUT type='button' id='cmdDelete' value='Delete' title='Delete a DR User from the Application.'
                                          OnClick='DRS_DeleteUser();' TabIndex='21' NAME='cmdDelete\">
                              </td>
      </tr>
</table>
                  <div id=\"dhtmltooltip\"></div>
            
            <script language=\"javascript\">
      setForm();

      function ResetWebcombo(webcomboid)
      {
      var combo = wcGetComboById('ddlUserName');
      combo.Text = \"NONE\";
      combo.Value = \"0\";
      combo.TextObj.value = \"NONE\";
      wcupdpd('ddlUserName');
      }
            </script>
</form>

0
 
amit_gCommented:
No we don't need to see the actual HTML but the actual behaviour to reproduce what you are describing. So even a 10 line HTML will do but give us a working sample where we can see the problem.
0
 
theMightyThor1212Author Commented:

this is the Code that returns the responseText of the XMLHTTPRequest Obj:

var HttpReq = New XMLHTTPRequest;
var divInnerHtml = document.getElementById("DivObj");
   HttpReq.open("GET",url,true);

   if (http.readyState == 4 && http.status == 200){
         divInnerHtml = http.responseText.replace(/\\"/g,'"');

       }
http.send(null);

Hopefully that is enough?
0
 
ZvonkoSystems architectCommented:
Two things are wrong there: the "true" parameter does say that the GET request is executed asynch.
Also the send() call is executed after the status compare.

So is my recomanded code NEVER executed.
Do it like this:


var HttpReq = New XMLHTTPRequest;
var divInnerHtml = document.getElementById("DivObj");
   HttpReq.open("GET",url,false);
   HttpReq.send();

   if (HttpReq.status == 200){
         divInnerHtml = HttpReq.responseText.replace(/\\"/g,'"');

   }

0
 
theMightyThor1212Author Commented:
Sorry i did it from memory because i am at another computer in a class.
0
 
theMightyThor1212Author Commented:
I also tried to keep it short, but in essence that is the way the call is made
0
 
theMightyThor1212Author Commented:
Here is the Full code:
var divInnerHtml = document.getElementById("DivObj");


function handleHttpResponse() {
     var strLastResult = "";

  if (http.readyState == 4 && http.status == 200) {
          if (http.responseText.indexOf('invalid') == -1) {
                    divInnerHtml.innerHTML = http.responseText.replace(/\\"/g,'"');;
                   
              }
        }
  }




function getHTTPObject() {
  var xmlhttp;

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
        xmlhttp.overrideMimeType("text/xml");
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object

    http.open("GET", url, true);
    http.onreadystatechange = handleHttpResponse;
    http.send(null);


Remember this is just a test page and test code
0
 
amit_gCommented:
With this code (and I had a similar code to test) I don't see the \" anywhere. Alert or the rendered HTML inside the Div tag is perfectly fine. There is no \" in it. And I had changed

http.responseText.replace(/\\"/g,'"');;

to

http.responseText;

so there was no replace also.

The XMLHttp or JavaScript DOES NOT escape the double quotes (") by itself. So there must be something else going on in your code.
0
 
theMightyThor1212Author Commented:
There is nothing else going on in the code, you see it as it appears on the page.
0
 
amit_gCommented:
It is hard to solve something that can't be reproduced. I tried your code with \" in it and if I had replace in place, it replaced all instances of \" with ".

Is it possible for you to host a working sample with the problem somewhere and give us the URL?
0
 
theMightyThor1212Author Commented:
Is it Possible that a script Blocker percieves the XMLHTTPRequest Objects open Call as Live script and thus, add the \" to disable script?
0
 
amit_gCommented:
I don't know. Disable the script blocker and see if it makes it any better. Also test the code from some other computer to eliminate the possibilty of something on the machine your are testing from now.
0
 
theMightyThor1212Author Commented:
Amit_g

   would you post the code that worked for you? Did you used the XMLHTTPRequest Object as well then did the replace on Resonsetext.?
thanks in advance
0
 
amit_gCommented:
I used exact same code that you have posted. The only thing I changed was the URL to another very simple test page.
0
 
theMightyThor1212Author Commented:
I am closing this question and splitting points as i feel like you guys were very patience in trying to answer this question. I still have no clue why i am getting the Return
I am getting, but it will have to wait for a new computer that is being set up and loaded as we speak.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 17
  • 9
  • 7
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now