I am using the jQuery load() method to load content into a page depending on the value added into an input field. For some reason I am getting multiple ajax calls at once so the content I am calling is appearing twice in the page rather than just once.
Hope that makes sence!
Here is the code I am working on:
function Acun () {
var firstChar = $('#accountnumber').val().charAt(0);
if(firstChar != 'x' && firstChar != 'X'){
$('#examplepagecontent').html('<div id="invoice-loader"></div>');
$("#examplepagecontent" ).load( "/product/pay-an-invoice #content");
}
else {
$('#examplepagecontent').html('<div id="invoice-loader"></div>');
$("#examplepagecontent").load("/product/pay-an-invoice-with-account-z #content");
}
}
HTML:
<input type="text" name="Account Number" value=""
id="accountnumber" name="accountnumber" onKeyUp="Acun();" maxlength="7"/>