0

I have a javascript function is an ASP.NET application that is rendering different results based on whether I build with Chrome or build with IE. Specifically, I've noticed that when I change the code in Visual Studio, the changes to the code are captured in IE, but are not in Chrome.

// js function
$(optA).change(function () {
    var flag = $(this).val();
    var security_name = $(optType).val();
    var extract = security_name.substr(0,security_name.indexOf('-'));
    $.ajax({
        type:"POST",
        url: "relevant_class.asmx/GetTerms",
        data: "{ 'security_name': '" + security_name + "', 'flag': '" + flag + "'}", //Line that doesn't change in chrome but does in IE.
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {
            // sets some other terms 
        }
        failure: function (msg) {
            alert(msg);
        }
    })
});

public List<int> GetTerms(string security_name, string flag)
{
    Debug.WriteLine(security_name);
    Debug.WriteLine(flag);
}

If I change the AJAX data line

data:"{ 'security_name': '" + security_name + "', 'flagBOGUSENTRY': '" + flag + "'}" 

When I go the inspect element --> network tab and look at the request body of the GetTerms call function, in Chrome I see

{'security_name': 'Apple', 'flag' : 'two-week'},

whereas in Internet Explorer I see

{'security_name': 'Apple', 'flagBOGUSENTRY': 'two-week'}

i.e. Internet Explorer has reflected my changes, but not Chrome. Why might this be happening?

kashmoney
  • 412
  • 1
  • 5
  • 17
  • 1
    have you tried clearing cache in chrome? go to sources tab in dev tools and look at your code to see if it has been updated. If not, you know its a caching issue. – Isaac Vidrine Oct 04 '18 at 16:09
  • yes, that hasn't worked – kashmoney Oct 04 '18 at 16:13
  • 1
    `Specifically, I've noticed that when I change the code in Visual Studio, the changes to the code are captured in IE, but are not in Chrome.` - What you are describing is a caching issue. – Isaac Vidrine Oct 04 '18 at 16:16
  • Correction: I just relaunched again and it works, clearing the cache did work. Thanks! – kashmoney Oct 04 '18 at 16:20
  • If I make any further changes to the Javascript, will I have to clear cache again? If so, is there a way to avoid having to do this each time? – kashmoney Oct 04 '18 at 16:22
  • 1
    Check out [this](https://stackoverflow.com/questions/23751767/chrome-disable-cache-for-localhost-only) – Isaac Vidrine Oct 04 '18 at 16:43

0 Answers0