Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

how to call a url using on click event

Posted on 2014-04-11
6
Medium Priority
?
263 Views
Last Modified: 2014-04-16
Hi,

How to call  an  url or a page  from a Jquery  on click event.


Thank you
0
Comment
Question by:roy_sanu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 20

Accepted Solution

by:
chaitu chaitu earned 2000 total points
ID: 39993877
$('#Test').click(function() {
  window.location = 'http://www.google.com'
  return false;
});
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 39994004
window.loaction returns the actual url. You have to use one of the following:

window.location.assign('http://www.google.com');
or
window.loacation.href = 'http://www.google.com';
or
window.loacation.replace = 'http://www.google.com';

$('#Test').click(function() {
  //choose one and uncomment it
  //window.location.assign('http://www.google.com');
  //window.loacation.replace = 'http://www.google.com';
  window.loacation.href = 'http://www.google.com';
  return false;
}); 

Open in new window

0
 

Author Comment

by:roy_sanu
ID: 39994020
suppose i have a url path such as /jsp/user.html

can i use like this

$('#Test').click(function() {
  window.location = "/jsp/user.html"
  return false;
});
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 39994067
yes.

or you can use window.location.href = "/jsp/user.html"
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 39994116
I'm sorry: I always used window.location only to get current page url :-(
I sign off from this question, now.
Cheers
Marco
0
 

Expert Comment

by:Rawbin
ID: 39996133
You can use like this:

<button onclick="myFunction()">Click to Open New Window</button>

<script type="text/javascript">
function myFunction() { window.open('www.sample.com', '_blank', 'toolbar=1,location=0,menubar=0'); }
</script>

www.sample.com => your website
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

647 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question