开发者

OK I am stumped!! IIS7 vs my javascript

I made a couple of changes to my javascript (which uses jquery ajax get). All I did was add an alert to see what was being sent. So the alert showd me what I wanted to see and I removed it from the script.

But now no matter what I do it keeps on popping up the alert. Somewhere somehow it seems to be cached. I cleared my browser cache. I even went onto a different system and it still pops up. When I remove all the code and I just leave an empty .js file it is fine. But the moment I put the code back it starts doing the alerts again.

I double tripled and double tripled checked again. I removed the 1 alert statement I had.

What must I do? Help thanks.

(function($){$.cabrowserTest=function(a,z){var u='unknown',x='X',m=function(r,h){for(var i=0;i<h.length;i=i+1){r=r.replace(h[i][0],h[i][1]);}return r;},c=function(i,a,b,c){var r={name:m((a.exec(i)||[u,u])[1],b)};r[r.name]=true;r.version=(c.exec(i)||[x,x,x,x])[3];if(r.name.match(/safari/)&&r.version>400){r.version='2.0';}if(r.name==='presto'){r.version=($.cabrowser.version>9.27)?'futhark':'linear_b';}r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape']]):a).toLowerCase();$.cabrowser=$.extend((!z)?$.cabrowser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.cabrowser.name,$.cabrowser.className,$.layout.name,$.layout.className].join(' '));}};$.cabrowserTest(navigator.userAgent);})(jQuery);

var caHref = window.location.href;
var numRand=0;

function pProcess()
{
    var pname = "";
    var phref = "";
    var pqty  = "";
    var pcip  = "";
    var pcit  = "";
    var custa = "";
    var custb = "";
    var custo = "";
    var prod  = "";
    var custd = ""; 

    var caSURL = "https://"+caHref.substring(caHref.indexOf("/",0)+2,caHref.indexOf("/",7));

    $.ajaxSettings.async    = false;
    $.ajaxSettings.cache    = false;    

    function handle(table) {
        custa = '&abanurl='+caHref;
        custb = '&br开发者_JAVA百科owser='+escape($.cabrowser.name+' '+$.cabrowser.version);
        custo = '&os='+$.os.name;   
        custd = 'custfname='+escape(CustFName)+'&custlname='+escape(CustLName)+'&custemail='+CustEmail;    

        table.find('tr').each(function() {                  
            pname = $(this).find('.PName a:first').text();
            phref = $(this).find('.PName a:first').attr('href');
            pqty  = $(this).find('.Quantity input:first').val();
            pcip  = $(this).find('.IndividualP').text();
            pcit  = $(this).find('.TotalP').text();         

            prod+= '&pName='+escape($.trim(pname))+'&purl='+escape($.trim(phref))+'&pqty='+$.trim(pqty)+'&pcip='+$.trim(pcip)+'&pcit='+$.trim(pcit);            
            return false;
        });

        if (prod != "") {
            CrossDomain();
            $.get('https://www.SOMEWEBSITE.com/default.asp?'+custd+prod+custa+custb+custo+'&rnd='+numRand, function(){return false;});
        }       

    }        

    if (caHref.search('finish.php')==-1)
    {
        var table = $('<table/>');
        table.load('/mypage.php?Check=1 .Contents tbody', function(){handle(table);});
    } else if (caHref.search('finish.php')>-1) {
        CrossDomain();  
        $.get('https://www.SOMEWEBSITE.com/cart/?custemail='+CEmail+'&fin=1&rnd='+numRand, function(){return false;});      
    } 

    if (prod=="" && caHref.search('finish.php')==-1)
    {
        CrossDomain();
        $.get('https://www.SOMEWEBSITE.com/default.asp?'+custd+custa+custb+custo+'&rnd='+numRand, function(){return false;});
    }
}; 

if ( $.cookie("YouAreLogin")!=null && caHref.search('Check')==-1 )
{

    $(document).ready(function() {    
        $('#frm input[type="image"]').click(function () { 
            $.get('https://www.SOMEWEBSITE.com/mypage.asp?product='+caHref+'&rnd='+numRand, function(){return false;});         
        });
    });

    pProcess(); 

}


function CrossDomain()
{
    $.ajaxSettings.crossDomain = true;
    $.ajaxSettings.timeout     = 5000;
    $.ajaxSettings.jsonp       = false;
    $.ajaxSettings.dataType    = "jsonp";

    numRand = Math.floor(Math.random()*9999999) + parseFloat(1000);
}

The numRand I added to see if that would work. The link to the website I have replaced as at the moment it is not puplic knowledge.


Looks like a caching issue.

Can you first check to make sure if it is/is not a caching issue. You can check the HTTP response code for the js file you are using ( user Firebug in Firefox, it should be other than 304 Not Modified).

Also check to make sure that the content of the js file that is transffered has alerts in it or not.

Can you post back what you see after that here?


Well only option left which sorted it out! I never want to go through this again! We uninstalled IIS and reinstalled. Problem sorted. What a nighmare! Thanks to all those who picthed in. I really appreciate it!


just had this occur on my local dev environment - win7 64 bit enterprise SP1 - IIS7 - VS2010 - javascript is inside an old classic site running thru IIS7 not studio's internal server.

Possible clue: have never had this happen to me until i created an active x control for the site...

first - what worked: runnign CCLeaner over the system - all cookies and registry clean - restart and sigh finally working.

tried (all failed):

  • iisreset
  • updating affected files, writing alerts into the code
  • recycle app pools / stop / start site
  • added no-cache rules for .asp, .js in IIS7
  • close re-open studio, close all restart computer.
  • delete temp files C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
  • uninstall IIS and re-install IIS

This was a javascript file included by classic asp pages - so where does the system cache js files i wonder? users/temp internet or something?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜