ajax - How to inline in javascript -
this sample code below want inline..
<script> $(document).ready(function(){ $('#secsubmit').click(function(){ $.ajax({ type: "post", url: 'process/process_mst.php?action=supplier_create', data: "sec_supplier=" + $('#sec_supplier').val() + "&sec_branch=" + $('#sec_branch').val() + "&sec_dmorigin=" + $('#sec_dmorigin').val() + "&sec_dmnum=" + $('#sec_dmnum').val() + "&sec_amount=" + $('#sec_amount').val() + "&sec_desc=" + $('#sec_desc').val() + "&sec_user_id=" + $('#sec_user_id').val(), success: function(data){ error = ''; if($('#sec_supplier').val() == "") error += ' - please select supplier'; if($('#sec_branch').val() == "") error += ' - please select branch'; if(error != '') alert(error); else{ alert("data inserted..."); window.location = "support_entry.php"; } } }); }); }); </script>
it display this:
- please select supplier - please select branch
i want display this:
-please select supplier </br> -please select branch </br>
you can use "\n" character line jump in alert box.
for example:
error += ' - please select supplier'+"\n";
Comments
Post a Comment