Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was trying to load new php page from one the PHP page using Jquery.



Checked my browser JS is also enabled. I tried it with Mozila, IE and Chrome.

Then i manage site in dreamweaver and I checked it there via live preview and when i clicked in click event, it loads properly.

But not in the above two methods with 3 browser.

I am confuse that what is missing here????

What I have tried:

JavaScript
window.location = 'admin-editcp.php'; // no success	

$(location).attr('href','admin-editcp.php'); // no success
Posted
Updated 31-Oct-17 23:17pm

Your question is not clear enough to answer properly;
What do you get? error? or what?
When do you expect the action? onclick? onload of window?
for onload try the following
<script type="text/javascript">
    window.location = "newpage.html";
</script>

you can also use window.onload; from browser to browser this particular funtion behave differently. Link GlobalEventHandlers.onload - Web APIs | MDN[^]
 
Share this answer
 
v2
I am having bootstrap nav bar and my objective is to load new PHP page when i click on menu.
So i need to create a click event for nav>ul>li>a.. I tried it as

$('ul.nav li').on("click", function(){
					alert("hi");
				 location.href = "https://stackoverflow.com/"; 
					//var NavId = this.id;
					
				//fxnNavClicked(NavId);
					
		});


But i have not got any success

part of php/html code

					<div class="collapse navbar-collapse navbar-right">
						<ul class="nav navbar-nav temp-nav">
							<li class="active"><a href="index.php">class="fa fa-home fa-lg"></a></li>

</ul></div>
<pre>
 
Share this answer
 
Comments
partapsingh 1-Nov-17 5:50am    
$('.nav a').on('click', function(){
alert("hi");
location.href = "https://stackoverflow.com/";
//var NavId = this.id;

//fxnNavClicked(NavId);

});
This is the code for nav>ul>li>a on click event...
it only display Hi but does not load the page

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900