0

How do i pass var rating and var itervalue into my window.location.replace? i get new rating variable from function updateRating() and when i click hireraccept, it assigns a new itervalue variable which i wish to pass them both into the "proceed" button into the window.location.replace url. any idea?

   <script type="text/javascript">
   $(document).ready(function(){
   var rating =  0;
   var itervalue = 0;

   $(".hireraccept").click(function(){
                $('.jRating').jRating();
                $("#dialog-rate").dialog("open");
                var itervalue = $(this).attr("value");


                return false

            });


            $("#dialog-rate").dialog({

                autoOpen: false,
                resizable: false,
                height: 200,
                width: 200,        
                modal: true,
                buttons: {
                    "Proceed": function(){

                        window.location.replace("{{ domain_url }}/workroom/accept/" + itervalue +"/" + rating);
                        $(this).dialog("close");

                    }

                }


            });

  });
 </script>
     <script type="text/javascript"> 
      function updateRating(rate,proceed){
      goodtogo = proceed;

      rating = rate;

} 
    </script>

1 Answer 1

1

You have your iterval declared globally, but then redeclare it locally. Remove the var declaration from your click handler and it will overwrite the global value, which you can then use in your dialog opening options.

// edit Change this

var itervalue = $(this).attr("value");

to this, and that should work

itervalue = $(this).attr("value");
Sign up to request clarification or add additional context in comments.

7 Comments

but i need to grab the click handler's itervalue value...how can i remove it? i need it exactly the opposite of what you are saying. i need the local variable to overwrite the global value so that another function can access it?
In the click handler you posted you're only setting the value for itervalue not rating.
Nope, my window.location.replace which is inside my proceed button has a rating & itervalue variable. So i need that too
I must be missing something in your code. Your dialog does not set the rating either. Unless you're setting rating somewhere else I don't see how it's being set anywhere.
Wups, missed that - When do you call that function?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.