[jQuery] Re: (validate), submitHandler and custom function

2009-09-16 Thread bgumbiker

Any Idea?
thanks

On Sep 15, 12:17 pm, bgumbiker  wrote:
> Indeed the message is sent with $.post(...) however it looks like the
> following code is not called:
>
> jQuery.ajaxSetup({
>   'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/
> javascript")}
>
> });
>
> and the server side code does not handle the request properly.
>
> Thanks!
> Bogumil
>
> On Sep 13, 10:01 pm, Jörn Zaefferer 
> wrote:
>
> > Try this:
>
> > submitHandler: function(form) {
> >   $.post(form.action, $(this).serialize(), null, "script");
>
> > }
>
> > Jörn
>
> > On Sun, Sep 13, 2009 at 12:42 AM, bgumbiker  
> > wrote:
>
> > > Hello,
> > > I am looking for a way to call successfully custom function from
> > > submitHandler to do proper ajax post.
>
> > > Here is my custom function:
>
> > > jQuery.fn.submitWithAjax = function() {
> > >  this.submit(function() {
> > >    $.post(this.action, $(this).serialize(), null, "script");
> > >    return false;
> > >  })
> > >  return this;
> > > };
>
> > > Before using validate plugin I had following which worked fine:
>
> > > $(document).ready(function() {
> > >   $("#my_form").submitWithAjax();
> > >  }
>
> > > Now I have added the validation part and have no idea how to call my
> > > custom submitWithAjax function??
>
> > > $(document).ready(function() {
>
> > >    $("#my_form").validate({
>
> > >                /*Validations - works perfectly!! */
>
> > >             },
>
> > >             submitHandler: function(form) {
>
> > >             /* $("#my_form").submitWithAjax(); - this works but
> > > introduces recursion */
>
> > >             /* how to call custom subitWithAjax() ? */
>
> > >             }
>
> > >        });
> > > })
>
> > > Thanks!


[jQuery] Re: (validate), submitHandler and custom function

2009-09-14 Thread bgumbiker


Indeed the message is sent with $.post(...) however it looks like the
following code is not called:

jQuery.ajaxSetup({
  'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/
javascript")}
});


and the server side code does not handle the request properly.

Thanks!
Bogumil





On Sep 13, 10:01 pm, Jörn Zaefferer 
wrote:
> Try this:
>
> submitHandler: function(form) {
>   $.post(form.action, $(this).serialize(), null, "script");
>
> }
>
> Jörn
>
> On Sun, Sep 13, 2009 at 12:42 AM, bgumbiker  wrote:
>
> > Hello,
> > I am looking for a way to call successfully custom function from
> > submitHandler to do proper ajax post.
>
> > Here is my custom function:
>
> > jQuery.fn.submitWithAjax = function() {
> >  this.submit(function() {
> >    $.post(this.action, $(this).serialize(), null, "script");
> >    return false;
> >  })
> >  return this;
> > };
>
> > Before using validate plugin I had following which worked fine:
>
> > $(document).ready(function() {
> >   $("#my_form").submitWithAjax();
> >  }
>
> > Now I have added the validation part and have no idea how to call my
> > custom submitWithAjax function??
>
> > $(document).ready(function() {
>
> >    $("#my_form").validate({
>
> >                /*Validations - works perfectly!! */
>
> >             },
>
> >             submitHandler: function(form) {
>
> >             /* $("#my_form").submitWithAjax(); - this works but
> > introduces recursion */
>
> >             /* how to call custom subitWithAjax() ? */
>
> >             }
>
> >        });
> > })
>
> > Thanks!


[jQuery] Re: (validate), submitHandler and custom function

2009-09-13 Thread Jörn Zaefferer

Try this:

submitHandler: function(form) {
  $.post(form.action, $(this).serialize(), null, "script");
}

Jörn

On Sun, Sep 13, 2009 at 12:42 AM, bgumbiker  wrote:
>
> Hello,
> I am looking for a way to call successfully custom function from
> submitHandler to do proper ajax post.
>
> Here is my custom function:
>
> jQuery.fn.submitWithAjax = function() {
>  this.submit(function() {
>    $.post(this.action, $(this).serialize(), null, "script");
>    return false;
>  })
>  return this;
> };
>
> Before using validate plugin I had following which worked fine:
>
> $(document).ready(function() {
>   $("#my_form").submitWithAjax();
>  }
>
> Now I have added the validation part and have no idea how to call my
> custom submitWithAjax function??
>
> $(document).ready(function() {
>
>    $("#my_form").validate({
>
>                /*Validations - works perfectly!! */
>
>             },
>
>             submitHandler: function(form) {
>
>             /* $("#my_form").submitWithAjax(); - this works but
> introduces recursion */
>
>             /* how to call custom subitWithAjax() ? */
>
>             }
>
>        });
> })
>
>
> Thanks!
>
>
>
>
>