Completed

Clean jquery post response

I need addition to the below jQuery response that will cleanly clear sent post data and clear input values so that additional request can be made cleanly.

In addition I require the code required to trigger both a successful and failed response to the form post request from the /[login to view URL] file.

Here is the form to work with:

<form id="trans-form">

<select name="make" id="make" required >

<option value="" class="first_option" selected="selected" disabled>Select Asset</option>

<option value="1">car</option>

<option value="2">truck</option>

</select>

<input type="text" name="model" placeholder="Model" value="" readonly />

<input type="number" name="amount" placeholder="Transfer Amount" required />

<input type="text" name="trans-address" id="trans-address" placeholder="address" required />

<input type="submit" name="trans_sub" value="SUBMIT" />

<div id="fal" class="hid-fal">There has been an error. Please re-check your input and try again.</div>

<div id="suc" class="hid-suc">Please check your email to authorise request.</div>

<div id="proc" class="hid-proc">Processing......</div>

</form>

<script type="text/javascript">

jQuery(document).ready(function() {

jQuery('#make').change(function() {

var balance = jQuery('#make').val();

switch(balance)

{

case '1':

jQuery('[name=model]').val('ford');

break;

case '2':

jQuery('[name=model]').val('nissan');

break;

default:

jQuery('[name=model]').val('all');

}

});

jQuery('form#trans-form').on('submit', function(e) {

jQuery('#fal').hide();

jQuery('#suc').hide();

jQuery('#proc').show();

[login to view URL]('/[login to view URL]', jQuery(this).serialize(), function (data) {

// 'data' contains the response from the request

jQuery('#proc').hide();

jQuery('#fal').hide();

jQuery('#suc').show();

// need function here that cleanly clears form inputs and clears all cached information from post request/response

}).error(function() {

// This is executed when the call failed.

jQuery('#proc').hide();

jQuery('#suc').hide();

jQuery('#fal').show();

// need function here that cleanly clears form inputs and clears all cached information from failed post request/response

});

[login to view URL]();

});

});

</script>

Skills: AJAX, Javascript, jQuery / Prototype, PHP

See more: $.post jquery, jquery post json data, javascript ajax post, $.post javascript, jquery ajax post json, jquery post form data, jquery ajax data, jquery ajax post form, http post response redirect html sample, jquery post alert, clean style post, php xml post response, jquery post ajaxform, jquery post selected select box, jquery post ajax zendframework, jquery post selectbox, jquery post xml save, jquery post mysql, php parse post response, post response fedex php

About the Employer:
( 38 reviews ) Abu Dhabi, United Arab Emirates

Project ID: #15651382

Awarded to:

baselIssmail

I'd be more than happy to Finish your project effeciently. I noticed that you're from UAE, so we can speak Arabic if it's better for you. Relevant Skills and Experience I have knowledge in all of the required skills. More

$15 USD in 1 day
(1 Review)
0.4

5 freelancers are bidding on average $24 for this job

$25 USD in 1 day
(36 Reviews)
4.6
arrowsoftSrls

Hello Sir! We have skills in jQuery! If it is ok for you, we can fix your code tomorrow in morning!

$35 USD in 1 day
(11 Reviews)
4.0
$25 USD in 1 day
(1 Review)
3.0
dominx99

A proposal has not yet been provided

$20 USD in 1 day
(1 Review)
0.7