8
Answers

jQuery function and redirect to page at a single btton click

I have a html form, in which i call a php page. I want to insert the form values into table and if it is success then it will redirect home page as well as generate a pdf file based on the form value. i have pdf generate code as well as the insert code, But i am not able to to call both jQuery function and PHP at a same time.
 
i want to redirect a html page and generate a pdf in a single button click. 
How will i do it in a single submit button click.
Thanks in advanced.


Answers (8)
0
Dipankar Biswas

Dipankar Biswas

NA 3k 125.6k 9y
hi... 
 
try it..
 
<input type="submit" value="One click 2 event" id="page1" class="page2"></p>
020 
021<script>
022$("#page1").click(function(){
023window.open('page.php','_self');
024});
025 
026$(".page2").click(function(){
027window.open('page2.php','_blank');
028});
029 
030</script>
 
 
Check this link more help..
 http://hepspace.com/web/answer_view.php?ID=4&qus=jquery%20onclick()%20function%20not%20working%20properly.%20whats%20wrong%20here??
 
 
0
Amit Kumar

Amit Kumar

NA 3.5k 203.7k 9y
Ok Dear
0
arijit karmakar

arijit karmakar

NA 7 364 9y
Thanks for your help. I will try this and let you know.
0
arijit karmakar

arijit karmakar

NA 7 364 9y
Thanks for your help. I will try this and let you know.
0
Amit Kumar

Amit Kumar

NA 3.5k 203.7k 9y
Hi  Dear, 
               U can use like..
 
$(".submit").click(function (e) {
e.preventDefault();
if ($(".issue-input").val().length == 0) {
window.location.href = "http://www.google.com";
} else {
window.location.href = "http://www.yahoo.com";
};
});
 
0
Rajeev Punhani

Rajeev Punhani

NA 4.7k 402.7k 9y

Hi Arjit,

In php we have header function use that.

http://www.cyberciti.biz/faq/php-redirect/ 

 If the above solution is helpful then,accept the answer.
0
arijit karmakar

arijit karmakar

NA 7 364 9y
Could you please give me an example for that? it will be helpful for me if you give me that.. :)
0
Rajeev Punhani

Rajeev Punhani

NA 4.7k 402.7k 9y

Hi Arjit,

In php only after generating pdf you can redirect to new page.