> Hi, > > I would like to send a parameter in the error callback : > > var optionsPrcPic = { > beforeSubmit: showRequestPic, // pre-submit callback > success: showResponsePic, // post-submit callback > dataType: 'json', > url: "<?php echo $this->baseUrl; > ?>/members/profile/add-photo/pic/"+pic, > error: errorPic, //error callback > timeout: 600000}; > > function errorPic(xhr, status, ex) { > [...] > > } > > I want to give to the error callback the 'pic' variable to know which pic > caused error. > > Anyone has an idea ? > > Thanks !
Try this: function showRequestPic(arr, $form, opts) { opts.pic = // whatever the pic is } function errorPic(xhr, status, ex) { var pic = this.pic; }