How to use the context variable in ajaxSetup with jquery
Posted
by
user1730491
on Stack Overflow
See other posts from Stack Overflow
or by user1730491
Published on 2012-10-11T03:10:22Z
Indexed on
2012/10/11
3:37 UTC
Read the original article
Hit count: 336
I have multiple forms on one page and i am submitting them via Ajaxform plugin like this
<td> <form> form1 </form> </td>
<td> <form> form2 </form> </td>
var options = {
target: '.ajaxMessage',
dataType: 'json', // pre-submit callback
success: function(data, statusText, xhr, form){ myResponse(data,form)},
context: { element: this},
cache: false,
delegation: true,
type: 'POST' };
$(".rform").ajaxForm(options);
In mY AjaxSetup , i have this
beforeSend:function(xhr, settings){
$this = settings.context.element;
alert($this);
But its not working , alert says window object
© Stack Overflow or respective owner