jrausell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Sep-07 15:10 UTC
help: get div content from ajax.request?
hi,
(i''m new on ajax and prototype)
i have this:
new Ajax.Request(''./'',
{ method: ''post'',
parameters: $(''resultsextras'').serialize(true),
onSuccess:
function(transport){
var html = transport.responseText;
//html = the content of #result
$(''AJAXresults'').update(html );
$(''AJAXresults'').innerHTML;
}
} )
AND want extrat the content from a div #result in the var html, but i
don''t know how. I search the documentation of prototyte but i not find
the answer.
(sorry for my english)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
You want to update a div with the response of the ajax request *plus*
store the response in a global variable? This might work.
new Ajax.Updater("AJAXresults", "./", {
parameters: $("resultextras").serialize(true),
onComplete: function(transport) {
window.ajaxResponse = transport.responseText;
}
});
On 9/7/07, jrausell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
<jrausell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> hi,
>
> (i''m new on ajax and prototype)
>
> i have this:
>
> new Ajax.Request(''./'',
> { method: ''post'',
> parameters:
$(''resultsextras'').serialize(true),
> onSuccess:
> function(transport){
> var html = transport.responseText;
> //html = the content of #result
>
$(''AJAXresults'').update(html );
>
$(''AJAXresults'').innerHTML;
> }
>
> } )
>
> AND want extrat the content from a div #result in the var html, but i
> don''t know how. I search the documentation of prototyte but i not
find
> the answer.
>
> (sorry for my english)
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
jrausell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Sep-07 15:58 UTC
Re: help: get div content from ajax.request?
mmm not exactly,
i want update a div (#AJAXresultextras) whit the content of another
div in the data return by de request or updater.
e.g.
//we have this html
<div id=''mydiv''>contenido</div>
//call the request:
new Ajax.Request(''./'',
{ method: ''post'',
parameters: $
(''resultsextras'').serialize(true),
onSuccess:
function(transport){
var html transport.responseText;
//html = the content of
#result
$(''mydiv'').update(html
);
$(''mydiv'').innerHTML;
}
} )
//(or the updater)
//and mypage.php return this html:
<p>hola que tal</p>
<div id=''mydiv2''>nuevo contenido</div>
<p>para rellenar</p>
//but I only want update mydiv whit the mydiv2 content "nuevo
contenido"
On Sep 7, 5:44 pm, "Nicolás Sanguinetti"
<godf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> You want to update a div with the response of the ajax request *plus*
> store the response in a global variable? This might work.
>
> new Ajax.Updater("AJAXresults", "./", {
> parameters: $("resultextras").serialize(true),
> onComplete: function(transport) {
> window.ajaxResponse = transport.responseText;
> }
>
> });
>
> On 9/7/07, jraus...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
<jraus...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > hi,
>
> > (i''m new on ajax and prototype)
>
> > i have this:
>
> > new Ajax.Request(''./'',
> > { method: ''post'',
> > parameters:
$(''resultsextras'').serialize(true),
> > onSuccess:
> > function(transport){
> > var html =
transport.responseText;
> > //html = the content of
#result
> >
$(''AJAXresults'').update(html );
> >
$(''AJAXresults'').innerHTML;
> > }
>
> > } )
>
> > AND want extrat the content from a div #result in the var html, but i
> > don''t know how. I search the documentation of prototyte but i
not find
> > the answer.
>
> > (sorry for my english)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---