2
I wanted to know if there is a way to present a new html page using a string containing all the content of the new page that I am trying to present, the code is below:
$("#form").on('valid.fndtn.abide', function () {
var data = $(this).serializeArray();
sendAjax('index.php?uc=eventos&a=logView', 'POST', data, function (data) {
try {
var data = jQuery.parseJSON(data);
if (!data.status) {
alertify.error("A hora ou a Data inserida excede a hora e a data corrente! " +
"Você não pode ver resgistros do futuro!");
}
} catch (e) {
document.open();
document.write(data);
document.close();
}
});
});
this document.write(data);
is where I write a new HTML page with the string received from the server, in firefox it works at first but if I update the resulting page it breaks all the formatting and Chrome repeats elements, ie is not a viable alternative, my question is, within that "date" I have my new string html as I do to display it in the browser window without using Document.write.
Thanks in advance for your attention and help.
There are two date variables in your code, the reference within the catch is getting the first, that’s right?
– user28595
when I do
var data = jQuery.parseJSON(data);
I’m creating another date reference in memory, so the date outside the catch has a different reference to what’s inside, same names plus different scopes and values too, I’ll change that because it causes confusion. But it was worth the remark.– Erick Batista