I read some posts related to this problem but unfortunately, no solution found for my case
i hit an error jquery.min.js:5 Uncaught TypeError: Cannot read property 'toLowerCase' of undefined when i make a following request jQuery ajax
ajax_test.htm
<script src="common_test.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
//String.prototype.trim = function(){return
//(this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""))}
$(document).ready(function() {
formDownloadFile();
});
function formDownloadFile() {
// jQuery ajax:
alert("sending ajax...");
jQuery.ajax({
type: 'POST',
url: 'ajax_test2.htm',
dataType: "text",
data: {}
})
.done(function(data, textStatus, jqXHR) { // Succes
console.log('done => data: ', data, ', textStatus: ', textStatus, ", jqXHR: ", jqXHR);
})
.fail(function(jqXHR, textStatus, errorThrown) { // fail
console.error('fail => jqXHR: ', jqXHR, ', textStatus: ', textStatus, ", error: ", errorThrown);
})
.always(function() { //
});
alert("ajax sended");
}
</script>
common_test.js: this library contains many javascript functions but i discovered that my problem is caused by the following function
... my stuffs ...
String.prototype.trim = function(){return (this.replace(/^[\s\xA0]+/,
"").replace(/[\s\xA0]+$/, ""))};
... my others stuffs ...
ajax_test2.htm have nothing!
when i remove incluse common_test.js from ajax_test.htm, i have no more problem! i don't understard why?
thanks a lot best regards dsea
common_test.js
has to have more content than that ? – adeneotoLowerCase
in it, so it can't produce that error – adeneo