AJAX

QuestionsAJAX
Filipe asked 12 years ago

Hi, i'm new in developer with PHP/ JavaScript e HTML.
I try access a page with the grid, but return nothing, just my html. If i open the page without ajax, the grid did open normal.

The code than used is:

if (xmlRequest.readyState == 4)
{
document.getElementById("conteudo").innerHTML = xmlRequest.responseText;

}

Sorry by the horrible english…

2 Answers
Abu Ghufran answered 12 years ago

Hello,

I dont fully understand your question. Perhaps you need to debug.

Use firefox->firebug->net->ajax-call of grid->response. You will see the output there, in case of any error. It should be proper JSON format data in order to render grid

Review this tutorial for debugging https://phpgrid.desk.com/customer/portal/articles/926266

__

Filipe answered 12 years ago

Let me explain better, i trying call a page .php with the grid. When i call the page by "<a hef", it's fine, but if i call using ajax, nothing happens.
Looking the source in the browser, i see the codes of my page, but in the div( that is the place of the grid) is blank.

The code of AJAX, that i using is:

function GetXMLHttp()
{
if(! window.XMLHttpRequest)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
xmlHttp = new XMLHttpRequest();
}
return xmlHttp;
}

var xmlRequest = GetXMLHttp();

function mudancaEstado()
{
if (xmlRequest.readyState == 4)
{
document.getElementById("conteudo").innerHTML = eval(xmlRequest.responseText);

}

if (xmlRequest.readyState == 1)
{
document.getElementById("conteudo").innerHTML = "Carregando…";
}

}

function abrirPag(valor)
{
var url = valor;
xmlRequest.onreadystatechange = mudancaEstado;
xmlRequest.open("GET", url, true);
xmlRequest.send(null);
return url;
}

Your Answer

11 + 17 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?