In Progress

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 /[url removed, login to view] 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();

[url removed, login to view]('/[url removed, login to view]', 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

});

[url removed, login to view]();

});

});

</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, i need to hire jquery programmer from india, i need a translator for italian to english post, i need a quick web developer post ad, i need a loan to set up a business post comments 2016, i need a loan to free post ad, i need a employee for post online sites, onece i post a project on rentacoder do i need someone to accept it

About the Employer:
( 37 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
(0 Reviews)
0.0

6 freelancers are bidding on average $23 for this job

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
(14 Reviews)
3.5
$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
$15 USD in 1 day
(1 Review)
0.9