Hi guys I have a problem where by I am doing an AJAX callback:
var htmlToInject;
function Next(step) {
var options = {
cache: false,
type: "POST",
url: "Page.aspx?Page=" + step,
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "html",
success: function (result) {
htmlToInject = result;
},
error: function (jqXHR, textStatus, errorThrown) {
},
complete: function (jqXHR, textStatus) {
$("#form1").empty();
$("#form1").append(htmlToInject);
}
};
$.ajax(options);
}
But the problem lies in where I am using jQuery validation methods and I am creating controls dynamically. So the callback does not cause a post back so controls would not be generated, which I solved by doing this:
$("#form1").empty();
$("#form1").append(htmlToInject);
Which then displayed the newly generated controls.
But validation on the fields is giving me errors: 'settings' is null.
I took a look at the page source and the source was there for the previously generated controls. I do not want to post back as I do not want the "loading" effect, hence why I am using ajax.
How can I over come this issue guys?
Many thanks in advance.