Pass GET parameter through AJAX to activate page

Asked

Viewed 128 times

1

I need to make the redirect after doing some commands in php need to load an ajax.

The link that sends to PHP page:

href="ajax/deletaPessoaVinculo.php?a=1&c=MEMBR&pb=3&p=vinculo.php?c=MEMBR"

After this I get in php from deletaPessoaVinculo.php

$w_COD_IDENT_VINCU = ( isset($_GET['c']) ? $_GET['c'] : "" );
$w_COD_IDENT_PESSO = ( isset($_GET['pb']) ? $_GET['pb'] : "" );
$w_acao = ( isset($_GET['a']) ? $_GET['a'] : "" );
$w_pagina = ( isset($_GET['p']) ? $_GET['p'] : '');

I do what I need to do on the page and at the end I do:

header('Location: ajax/'. $w_pagina);

But it’s not returning.

Actually I want to delete something, and while removing want from one reload on the page.

  • In the browser console, when you make this request, is it being redirected? I believe, that it does the redirect in the ajax request you made, I advise you to use some feedback instead of the redirect and depending on that return you do the re-load through the javascript

1 answer

1


This is happening, probably because the last parameter p is with the url p=vinculo.php?c=MEMBR, and there’s a ?, which means that will begin the part of queryString, however this part has already started, test leave the url parameter, getting:

href="ajax/deletaPessoaVinculo.php?a=1&c=MEMBR&pb=3&p=vinculo"

and by giving the redirect do this:

header('Location: ajax/'. $w_pagina . ".php?c=" . $w_COD_IDENT_VINCU);

Abs.

  • 1

    Your statement solved the problem, although I have not used this method for the same, I did giving include on the page, because the request was still accessible.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.