Preview Form Result With Ajax, jQuery and API -
so have form customers can generate quote products. want them able preview quote cost before submit finalized. have api built this
sitename.com/api/cart?model=1&height=700&width=550&cable_length=1&quantity=2&finish=polished_brass&rails=4&exit=top&concealed=0
with variables being same form element names. api retrieves number want display next form when click button.
how go doing this? i'm new ajax :/
not if question how pass form data in link or how handle returned result display it. anyway, can:
$('#myform').serialize();
which returns form values encoded in url form, , use on url of jquery.ajax()
request:
$.ajax('sitename.com/api/cart?' + $('#myform').serialize(), { datatype: 'html', success: function(html) { // result html page, paste inside "result" div: $('#result').append(html); } });
Comments
Post a Comment