In the Satchmo code (satchmo/satchmo/apps/satchmo_store/contact/templates/contact/_state_js.html) the following JavaScript is causing errors in Internet Explorer version 6:
/**
* Required for Django's CSRF protection when using AJAX
* Taken from here - http://docs.djangoproject.com/en/dev/ref/contrib/csrf/
*/
$('html').ajaxSend(function(event, xhr, settings) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
// Only send the token to relative URLs i.e. locally.
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
});
Specifically the following line is referenced by IE:
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
The problem occurs in a form which contains "Country" and "Province". Obviously if the Country changes, then the available Provinces must change. As soon as the user selects a Country, Explorer reports this error:
Line: 239
Char: 9
Error: Type mismatch
Code: 0
URL: http://10.1.1.7:8000/checkout/
Can anyone suggest what the problem is here? I don't really understand why it should be a "Type mismatch" either?
Many thanks, Thomas