user2244804
user2244804

Reputation:

Pass value and get value in jquery between two pages

I'm really struck here. I have a form and i want to submit it and get value on other page in Jquery:

<form id="rentals_form" name="popup_form" action="rentals.php" method="POST">
<input alt="" style="display:none;" id="copy_id" name="copy_id" type="text">
</form>

<button 
class="save_button" 
value="copy_listing_button" 
onclick="document.forms[$('#copy_listing option:selected').val()+'_form'].submit();" 
style="font-size:11px; padding:0 3px 0 3px;">
    Go
</button>

Now i want to get copy_id value in rentals.php with jquery not php

 $(document).ready(function() 
 {
// here I want to get copy_id value.please note this is jquery so i want to get in jquery
 });

Upvotes: 0

Views: 690

Answers (2)

pdegand59
pdegand59

Reputation: 13019

These lines in rentals.php will do the trick :

<!-- This should be somewhere in the <head> but before your main script -->
<script type="text/javascript">
    var copy_id_value = <?=$_POST['copy_id']?>;
</script>

Upvotes: 0

Ganesh RJ
Ganesh RJ

Reputation: 942

  1. Set cookie using js in the first page . Refer cookie to create cookie in js

2.get that cookie in other page.

Upvotes: 2

Related Questions