[jQuery] Bloated Return Data with AJAX, how do I validate?
Hey everyone. I'm using jQuery's "$.get("url",function(data)
{
// do something with "data"
}
);
and I've got everything working fine, but the problem is, my job site
employees some type of proxy/security device. It attaches a whole bunch of
javascript code to ANY page loaded on a browser. So, when my data is
returned, if the page was just echoing "Success" for everyone else (not on
our network), it actually echoes this for me:
------ DON'T BOTHER READING ANYTHING BUT THE LAST LINE HERE -----------
<script language='javascript'>
<!--
var bluecoat_allow_popup = false;
var bluecoat_original_open = window.open;
window.open = bluecoat_gated_open;
function bluecoat_gated_open(url, name, parms)
{
if (bluecoat_allow_popup) {
// A navigation event is restricted to opening at most one window.
bluecoat_allow_popup = false;
return bluecoat_original_open(url, name, parms);
} else if (window.event && window.event.shiftKey) {
// Popups can open freely while the shift key is held down.
// Only works in IE, and even then, not inside a Java app.
return bluecoat_original_open(url, name, parms);
} else {
// alert("blocked popup ('" + url + "', '" + name + "')");
window.status='blocked popup window -- use CTRL Refresh to see all
popups';
return null;
}
}
function bluecoat_stop_error()
{
return true;
}
window.onerror = bluecoat_stop_error;
function bluecoat_fixhandler(elem, attr)
{
var h = elem.getAttribute(attr);
if (h != null) {
if (typeof(h) == "string") {
if (h.substring(0,11) == "javascript:") {
if (h.substring(11,13) != "//") {
elem.setAttribute(attr,
"javascript:bluecoat_allow_popup=true;"
+ h.substring(11)
+ ";void(bluecoat_allow_popup=false)");
}
} else {
elem.setAttribute(attr,
"bluecoat_allow_popup=true;try{\n"
+ h
+ "\n}finally{bluecoat_allow_popup=false;}");
}
} else {
elem.setAttribute(attr,
function() {
bluecoat_allow_popup = true;
var result = h.call(elem);
bluecoat_allow_popup = false;
return result;
});
}
}
}
function bluecoat_fixpopups()
{
var i;
var j;
var ls = document.links;
for (i = 0; i < ls.length; ++i) {
var link = ls[i];
if (link.protocol == "javascript:"
&& link.href.substring(11,13) != "//")
{
link.href =
"javascript:bluecoat_allow_popup=true;"
+ link.href.substring(11)
+ ";void(bluecoat_allow_popup=false)";
}
bluecoat_fixhandler(link, "onclick");
bluecoat_fixhandler(link, "onmousedown");
bluecoat_fixhandler(link, "onmouseup");
}
var fs = document.forms;
for (i = 0; i < fs.length; ++i) {
var f = fs[i];
bluecoat_fixhandler(f, "onsubmit");
var es = f.elements;
for (j = 0; j < es.length; ++j) {
bluecoat_fixhandler(es[j], "onclick");
bluecoat_fixhandler(es[j], "onmousedown");
bluecoat_fixhandler(es[j], "onmouseup");
}
}
}
//-->
</script>Success
----------------------------------------
again, it should just be:
---------
Success
--------
So, how can I validate my returned data with this problem? I was originally
just doing a simple:
if (data == 'Success')
{ do something good }
else
{ bad result }
And this works great...so long as I'm not using the site at my job site.
Seeing as how the data will never be "good" because of this proxy junk, I
don't know what to do.
Any help would be appreciated in figuring out how to get around this. I've
tried doing a simple data.substr(-7), and that isn't returning the
appropriate data either.
Thanks in advance.
--
View this message in context: http://www.nabble.com/Bloated-Return-Data-with-AJAX%2C-how-do-I-validate--tf3201795.html#a8890340
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/