You have a textual bug in this update. New 'function' is missing
letter 'f' . See below.
-function ajax(u,s,t) {
- var query="";
- for(i=0; i<s.length; i++) {
- if(i>0) query=query+"&";
- query=query+encodeURIComponent(s[i])
+"="+encodeURIComponent(document.getElementById(s[i]).value);
- }
- jQuery.ajax({type: "POST", url: u, data: query, success:
function(msg) { if(t) { if(t==':eval') eval(msg); else
document.getElementById(t).innerHTML=msg; } } });
+unction ajax(u,s,t) {
+ query = '';
+ if (typeof s == "string") {
+ d = jQuery(s).serialize();
+ if(d){ query = d; }
+ } else {
+ pcs = [];
+ for(i=0; i<s.length; i++) {
+ q = jQuery("#"+s[i]).serialize();
+ if(q){pcs.push(q);}
+ }
+ if (pcs.length>0){query = pcs.join("&");}
+ }
+ jQuery.ajax({type: "POST", url: u, data: query, success:
function(msg) { if(t) { if(t==':eval') eval(msg); else jQuery("#" +
t).html(msg); } } });
}
On 8 čnc, 18:22, mdipierro <[email protected]> wrote:
> I just added it to trunk (welcome app). Please check it.
>
> On 8 Lug, 10:44, Skiros <[email protected]> wrote:
>
>
>
> > Hello everybody !
>
> > Some time ago was proposed a fix to ajax function in web2py_ajax in
> > this post:
>
> >http://groups.google.com/group/web2py/browse_thread/thread/35c5708111...
>
> > Is There some definition about this ?
>
> > Thanks !