manalnor Posted March 2, 2011 Share Posted March 2, 2011 Hello dear friends, say i've form with 2 variables which i want to post to another file file 1 <script type="text/javascript"> // <![CDATA[ $(document).ready(function(){ $('#loader').hide(); $('#inner').children().click(function(){ var a = $(this).attr("name"); $.post("rating.php?value="+a,{}, function(response){ $('#inner').fadeOut(); $('#inner').html(unescape(response)); $('#inner').fadeIn(); setTimeout("hideMesg();", 2000); }); }); }); function hideMesg(){ $('.rating_message').fadeOut(); $.post("rating.php?show=1", {}, function(response){ $('#inner').html(unescape(response)); $('#inner').fadeIn('slow'); }); } // ]]> </script> this will post the following ( the value of name ) <div class="rating_dis" name="<?php echo $k?>" id="<?=$id?>"> </div> but i want it also to post the value of the (id) here is the second file which should get the name if($_REQUEST['value']){ $name = $_REQUEST['value']; $query = "insert into rating (rated, channelid) values ('$name', '$idz')"; mysql_query( $query); } so the problem is how to send from file 1 to file 2 both the (name) and (id) how to double this ? var a = $(this).attr("name"); $.post("rating.php?value="+a,{}, to be also var a = $(this).attr("id"); $.post("rating.php?any="+a,{}, then i can get it from file 2 easily get both. thank you :'( Quote Link to comment Share on other sites More sharing options...
btherl Posted March 2, 2011 Share Posted March 2, 2011 Try this: var a = $(this).attr("id"); var b = $(this).attr("name"); $.post("rating.php?any="+a+"&value="+b,{}, Then you can use both $_REQUEST['value'] and $_REQUEST['any'] in rating.php Quote Link to comment Share on other sites More sharing options...
manalnor Posted March 2, 2011 Author Share Posted March 2, 2011 @btherl thank you so much , it works perfect now and i've understood it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.