[jQuery] Re: Jquery Form Plugin not sending name of button in Safari

2009-11-04 Thread petersendidit
Here is a patched version of the ajaxForm function that fixes the
problem.
$.fn.ajaxForm = function(options) {
return this.ajaxFormUnbind().bind('submit.form-plugin', function() {
$(this).ajaxSubmit(options);
return false;
}).bind('click.form-plugin', function(e) {
var $el = $(e.target);
var target = e.target;
if (!($el.is(":submit,input:image"))) {
var $parent = $el.closest(":submit");
if ($parent.length)
target = $parent[0];
else
return;
}
var form = this;
form.clk = target;
if (target.type == 'image') {
if (e.offsetX != undefined) {
form.clk_x = e.offsetX;
form.clk_y = e.offsetY;
} else if (typeof $.fn.offset == 'function') { // try 
to use
dimensions plugin
var offset = $el.offset();
form.clk_x = e.pageX - offset.left;
form.clk_y = e.pageY - offset.top;
} else {
form.clk_x = e.pageX - target.offsetLeft;
form.clk_y = e.pageY - target.offsetTop;
}
}
// clear form vars
setTimeout(function() { form.clk = form.clk_x = form.clk_y =
null; }, 10);
});
};

On Nov 4, 8:44 am, petersendidit  wrote:
> I have a form with 2 button elements in it.  Button elements are used
> because they are much easier to style as needed.
>
> 
>         
>         Save
>         Save As Copy
> 
>
> I am using the jquery form plugin (http://jquery.malsup.com/form/) to
> submit the form by ajax.  Everything works great in all browsers
> except for Safari and Chrome.  The problem in Safari and Chrome is
> that the name of the button that was pressed does not get sent back.
> My guess is that the form plugin is getting confused by the span
> inside the button and not grabbing the name from the button element.
> Is there a way to fix this?


[jQuery] Jquery Form Plugin not sending name of button in Safari

2009-11-04 Thread petersendidit
I have a form with 2 button elements in it.  Button elements are used
because they are much easier to style as needed.



Save
Save As Copy


I am using the jquery form plugin (http://jquery.malsup.com/form/) to
submit the form by ajax.  Everything works great in all browsers
except for Safari and Chrome.  The problem in Safari and Chrome is
that the name of the button that was pressed does not get sent back.
My guess is that the form plugin is getting confused by the span
inside the button and not grabbing the name from the button element.
Is there a way to fix this?


[jQuery] Problem with $.get() and array in json data

2009-06-16 Thread petersendidit

I am provided a json object that looks something like this:

{"pager_offset":50,"types":[1,2,4]}

If I feed that json object in to the jQuery $.get() function as the
data the request it makes is like this:

?pager_offset=50&types=1&types=2&types=4

Note that it really should be this in order for the server to be able
to handle it correctly
?pager_offset=50&types[]=1&types[]=2&types[]=4

Do I need to go and modify the json object before feeding it in to the
$.get() function? or is there something else I can do?