0

I have two PHP files one called cab.php and another called d3.php , I want to toggle

in the same file this works cab.php the problem is when I call the second file d3.php

function botaod2mostraesconde()
{
       $(".wrapd2").toggle();
       $(".datad2").toggle();
       $(".uploadd2").toggle();
}

here the input button :

<input type="button" value="D3" onclick="location.href = 'd3.php'">

I am looking for a way to toggle from different files. Thanks

0

1 Answer 1

1

You will need to run the JavaScript on the next page (d3.php). You can't execute client side script (JavaScript) on a php page that runs server side which hasn't yet been loaded in the client's browser.

This is based on an edict written in stone eons ago:

Thou shalt not execute client side code before server side code.

This would be akin to Luke attempting to destroy the Death Star before it's been created. Wait for the Death Star, you must. Then use The Force to destroy it.

Run d3.php first, then toggle elements on the page using JavaScript.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.