0

The variable checkedones is not passing to the AJAX.Updater.

The item.value is reporting a value so I know that there should be something there, however I'm just left with t pland when I get to the last alert.

How can this be fixed/improved?

    function sendemail(){
        var checkedones='';
        var i= $$('.emailer');
        i.each(function(item)
                {

                   if(item.checked){
                    alert(item.value);
                    alert(item.checked);
                    var checkedones = checkedones + item.value + ',';   
                  }
                }
        )
        alert(checkedones);
        new Ajax.Updater('asdfa', 'pages/domailing.php', {
     method:'post',evalScripts:'true' ,parameters: {
  subject1:$('subject1').value,
subject2:$('subject2').value,
body:tinyMCE.get('emailbody').getContent(),
value:checkedones},
evalJS:'force',
onComplete:function(){}
        });
    }

1 Answer 1

2

try changing: var checkedones = checkedones + item.value + ',';

to: checkedones += (item.value + ',');

you've re-declared by using var inside the loop.

Sign up to request clarification or add additional context in comments.

1 Comment

Brilliant. And much more elegant. thanks for the quick response.

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.