I would like to know if you have how to retrieve a variable from the URL to another page and return the result in load
. I am using the following script that normally retrieves the variable, but does not move to the next page. It's just to understand better what I need.
In URL http://noticias.php?categoria=23
, I get the variable normally but in load
comes the information that the resposta.php
page did not receive the variable. I would like to move to another page before showing the result in load
. What would be the correct way?
$(document).ready(function()
{
$('#teste').html("<img src='js/load.gif'>");
var variaveis=location.search.split("?");
var quebra = variaveis[1].split("=");
var categoria = + quebra[1];
var URL='resposta.php';
var dataString = 'categoria=' + categoria ;
$.ajax({
type: "POST",
url: URL,
data: dataString,
cache: false,
success: function(html){
$('#teste').load('resposta.php');
}
});
});
</script>