Click here to Skip to main content
15,937,186 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have an html page.

I am making an ajax call to a link and i get the html data which contains sId and sTmp values in it. I need to get all the values of sId and sTmp as key value pairs in my html page.

(There are about 106 sId's and sTmp values)

How to get all the values of sId and sTmp as key value pairs ?

Code of html data which contains sId and sTmp values:-

JavaScript
sId = "1407900387";

    if ((3 == 13) && "")

{
  var sLinkLocation = sAddJavascriptEscapes('');

  sUrl = "OpenInformationItemLocation(\"" + sLinkLocation + "\", );";

}

else

  sUrl = "OpenHeaderLinkFromTable(\"http://172.220.1.4/QPR2014-1/Portal/QPR.Isapi.dll?PGPLUGIN&*24&SES=mWh8OHy43bW3LC5kC9yM-A&FMT=p&SKIN=portal&LAN=en%2c1&MODELID=1470448858&OBJECTID=1407900387\",\"http://172.220.1.4/QPR2014-1/Portal/QPR.Isapi.dll?PGPLUGIN&*24&SES=mWh8OHy43bW3LC5kC9yM-A&FMT=p&SKIN=portal&LAN=en%2c1&MODELID=1470448858&OBJECTID=1407900387\",\"" + sId + "\");";

window._sDefaultLink = window._sDefaultLink || sUrl;

RC("<table border='0' cellpadding='0' cellspacing='0'><tr><td><a id=\"a" + sId + "\" href='java<!-- no -->script:" + sUrl + "' title='" + sTmp + "'><img src='http://172.220.1.4/QPR2014-1/qprsoftware/pg/images/icn_subprocess.gif' title='" + sTmp2 + "'> " + sTmp + "<\/a>" + sTools + "</td></tr></table>", sTmp);

sTmp = "";

if (sTmp != "")

  sTmp = "<table border='0' cellspacing='0' cellpadding='0'>" + sDecodeURI(sTmp) + "</table>";

RC(sTmp, "");


Code of html page:-

HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="jquery.js"></script>
<script type="text/javascript">

function dataRet (d){
console.log(d);
}
function ajaxreq(){
debugger
 $.ajax({

url: *some link*
      error: function(jqxhr) {
          alert(jqxhr.responseText); // @text = response error, it is will be errors: 324, 500, 404 or anythings else
          },
      dataType:'html',
      success: function(data) {
           alert(data);
           console.log(data);
           var decoding = sDecodeURI(data);
           console.log(decoding);
      },

      type: 'post'
   })

function sDecodeURI(vsStr) 
{
debugger
  try {
    if (typeof(vsStr) !== "string")
      return vsStr;

    var slSplit = vsStr.split('%u');
    if (slSplit.length === 1)
      return decodeURIComponent(vsStr);

    var sResult = new StringBuilder(decodeURIComponent(slSplit[0]));
    for (var i = 1; i < slSplit.length; ++i) {
      var sTmp = slSplit[i];
      var len = sTmp.length;
      if (len < 4)
        sResult.append("%u" + sTmp);
      else {
        var charCode = sTmp.substr(0, 4);
        sResult.append(String.fromCharCode(parseInt(charCode,16)));
        sResult.append(decodeURIComponent(sTmp.substr(4, sTmp.length-4)));
      }
    }
    return sResult.toString();
  }
  catch (e) {
    // Fallback to old-style encoding
    return unescape(vsStr);
  }
} 
   ;
}

</script></head>
<body>
<input onclick="ajaxreq()" type="button" value="Click me to load info!"></input>
<div id="info"></div>
</body>
</html>


What I have tried:

I have tried to call the data using substring and indexOf but i don't get the values..
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900