thank you for your quick answer! ive looked at your ecample and made
it the exact same way, but it doesnt work for me.
my request is:
var addTaskReq = new Request.HTML({
url: base_url + 'tasks/ajax_create',
data: 'project_id=' + project_id + '&task_title=' + task_title,
append: $('content'),
onSuccess : function(response) {
$(response[0]).addClass('red'));
}
}).send();
the alert is:
$(response[0]).addClass is not a function
the response of my request is:
<div id="task-40" class="task clearfix">
<div class="liquid_wrapper">
<label>
<input type="checkbox" value="" >www
</label>
</div>
<a href="#" class="btn right btn_del">×</a>
<a href="#" class="btn right btn">Bearbeiten</a>
</div>
i only want to add a onclick-event on to the wrapper div ( the one
with id="task-40" ),
but tried some simple stuff like adding a css-clss in the code above.
On 13 Aug., 22:41, Oskar Krawczyk <[email protected]> wrote:
> See a working example:http://www.jsfiddle.net/ZXrC6/
>
> On 2010-08-13, at 21:51, [email protected] wrote:
>
> > hi, i have some problems working with the ajax-response. i'm sending
> > some Request.HTML and gettin the response. the response is made from a
> > php à la : <div class="task" id="xx"> some other html </div>. now i
> > want to add some events on this div on the onSuccess()-method, but
> > neither through responseTree, responseElements or responseHTML i can
> > acces the div.
>
> > i tried: $(responseHTML), $(responseElements), $
> > (response).getElements('.task'), everything didn't workö
>
> > have you some idea? how can i access it?
>
> > thank you very much, i hope this is everything you need, i can post
> > further details if you need.
> > –penter