Passing Values To Jquery

I’m using the following code in order to gather the info I need to an email , and send it all to the controller.

Now , I’m using findAll to get all the users I need from the DB , but in the confirmation message the count=1 despite the fact that the findAll line is working in the controller and finds 220 users.

How to I pass all the @users to var checked?





			var checked='.$users.'; //              <------the line in question

			var subject=$("#subject").val();

			var message=$("#message").val();

			var count=checked.length;

			if(count>0 && confirm("Are you sure you want to send "+count+" emails?"))











Thanks ,



$users is a collection of Person object… u cannot assign like that…

By looking your code… i can only see the $users used to check the count. if that is the only intention… then follow below query to find count :)

Person::model()->count("status_id=:status_id", array("status_id" => "active"));

then u can assign directly to count variable :)

I hope your problem resolved :)

Actually I need to pass all the users that were found to the actionMailer in the controller.

For now , that query is already sitting there and the whole thing is working fine , but , when I click on the “send all” button , I can’t write in the “are you sure” message how much users I actually sending the mail to, thus I’m thinking about how to move the query here , so that I can add the count to the message.