This topic is locked
[SOLVED]

Button Error - Can't figure this one out

10/10/2024 10:00:49 PM
PHPRunner General questions
H
headingwest author

If I create a custom button and in the server code write

header("Location: prediction_list.php");
exit();

This causes a crash. Version 10.91

So add a button - it all works
Add Location: it now crashes
I've tried multiple buttons on multiple pages with multiple browsers. As soon as I try a redirect I get a crash.
But putting a redirect in an event works, it just crashes in buttons.

Clicking "See details" shows nothing.
I can;t any meaningful error message in the console. Response is "Failed to load response data"
I've tried a few browsers and they all have the same error.

Any ideas??

img alt

C
cristi 10/10/2024

Don't use PHP code to redirect - this is a custom button and things work different than events (you're redirecting an ajax call and not the window, that's why you get that error) - use javascript for this - see example No. 4 from here

Sergey Kornilov admin 10/11/2024

Button's code is executed via AJAX which means you cannot use redirect there. Read this for additional info:
https://xlinesoft.com/phprunner/docs/tri-part_events.htm