Skip to content

Instantly share code, notes, and snippets.

@alexdev27
Created April 4, 2017 00:19
Show Gist options
  • Select an option

  • Save alexdev27/7a3c496ad76be2402c2435a2a82fd439 to your computer and use it in GitHub Desktop.

Select an option

Save alexdev27/7a3c496ad76be2402c2435a2a82fd439 to your computer and use it in GitHub Desktop.

Revisions

  1. alexdev27 created this gist Apr 4, 2017.
    16 changes: 16 additions & 0 deletions ajaxfunc.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    function ajaxForm(form, urlToFile) {
    // if (!valid) {return false;}

    var serailizedForm = form.serialize();

    var result = $.ajax({
    url: urlToFile,
    type: 'post',
    // dataType: 'json',
    data: serailizedForm,
    }).fail(function(answerFromServer){
    alert('AJAX FAIL ');
    });

    return result;
    }