$(document).ready(function()
{
    $.setAjaxForm('#providerForm', function(response)
    {
        if(response.result == 'fail')
        {
            if(response.error && response.error.length)
            {   
                $('#duplicateError').html($('.errorMessage').html());
                $('#duplicateError .alert').prepend(response.error).show();

                $(document).on('click', '#duplicateError #continueSubmit', function()
                {   
                    $('#duplicateError').append("<input value='1' name='continue' class='hide'>");
                    $('#submit').attr('type', 'button');
                })  
            }   
        }
        else
        {
            setTimeout(function(){location.href = response.locate;}, 1200);
        }
    });
})
