0
new Ajax.Request('Handler.ashx',
            {
                method: 'get',
                onSuccess: function(transport)
                {
                    var response = transport.responseText || "no response text";
                    //alert("Success! \n\n" + response);
                    var obj = response.evalJSON(true);
                    alert(obj[0].Nam);
                    alert(obj[0].IM);
                    for(i = 0; i < 4; i++)
                    {
                        $('MyDiv').insert(   new Element('checkbox', { 'id': "Img" + obj[i].Nam, 'value': obj[i].IM }) );
                        return ($('MyDiv').innerHTML);
                    }


                },
                onFailure: function() { alert('Something went wrong...') }
            });
4

1 回答 1

0

checkbox不是有效的标签名称。你想创造<input type="checkbox" />吗?

new Element('input', { type: 'checkbox', ... })

return此外,调用onSuccess 回调函数也没有任何意义。

于 2010-03-29T09:40:53.687 回答