
function dealSubscriber(id)
{

//alert(id);

var optionsdealSubscriber = {
target:        '',   // target element(s) to be updated with server response
beforeSubmit:  dealSubscriberRequest,  // pre-submit callback
success:       dealSubscriberResponse,  // post-submit callback
url: 'api/subscriber.php',
type:      'post',        // 'get' or 'post', override for form's 'method' attribute
dataType:  'json'  //,html, json
};

$("#"+id).ajaxSubmit(optionsdealSubscriber);
return false;
}

// pre-submit callback
function dealSubscriberRequest(formData, jqForm, options)
{
return true;
}

function dealSubscriberResponse(responseText, statusText)
{
//alert(responseText);
    var html='';
var success = responseText.success;
var msg = responseText.msg;
var signup = responseText.signup;


  if( success==true)
      {
      html=' <div class="success">'+msg+'</div>';
  var url=responseText.url;
  // window.location = url;

if(signup==true)
    {
$('#subscribeUpdateDiv').jqm();
$('#subscribeUpdateDiv').jqmShow();
    }
      }
      else

      {
     alert(msg);
     html='<div class="error" >'+msg+'</div>';
      $('#dealSubscriberEmail').focus();

      }



  $('#user-subscription-box-result').empty();
 $('#user-subscription-box-result').html(html);
  $('#user-subscription-box-result').show();
}






function updateDealSubscriber(id)
{

//alert(id);

var optionsdealSubscriber = {
target:        '',   // target element(s) to be updated with server response
beforeSubmit:  updateDealSubscriberRequest,  // pre-submit callback
success:       updateDealSubscriberResponse,  // post-submit callback
url: 'api/subscriber-update.php',
type:      'post',        // 'get' or 'post', override for form's 'method' attribute
dataType:  'json'  //,html, json
};

$("#"+id).ajaxSubmit(optionsdealSubscriber);
return false;
}

// pre-submit callback
function updateDealSubscriberRequest(formData, jqForm, options)
{
return true;
}

function updateDealSubscriberResponse(responseText, statusText)
{
//alert(responseText);
    var html='';
var success = responseText.success;
var msg = responseText.msg;



  if( success==true)
      {
      html=' <div class="success">'+msg+'</div>';
  var url=responseText.url;
  // window.location = url;
var id ='subscribeUpdateDiv';
  setInterval("$('#"+id+"').jqmHide();",500);
      }
      else

      {
      html='<div class="error" >'+msg+'</div>';
      $('#dealSubscriberEmail').focus();

      }



  $('#update-subscription-box-result').empty();
 $('#update-subscription-box-result').html(html);
  $('#update-subscription-box-result').show();
}

function hideModelPopUp(id)
{
   $('#'+id).jqmHide();
}
