javascript - Insert text before submitting HTML button -
i have button calls ajax once submit need add input have enter text , if text same text found in db button should execute ajax. how can done?
this ajax code:
<script> jquery(function(){ jquery(".canjear").click(function(e){ if(this.tagname==="a"){ e.preventdefault(); } jquery.ajax({ url: "index.php?option=com_cuphoneo&task=miscuponess.canjearcupon", type: "post", data: {id:jquery(this).data("id")}, success: window.location.href = "index.php?option=com_cuphoneo&view=miscuponess&layout=default" }); }); }); </script>
this php/html button:
<div class="panel-boton-canjear"> <?php foreach($campos_extra $value){ if($value->id == 17){ if(!empty($value->value)){ ?> <input class="canjear btn" type="button" value="<?php echo jtext::_('com_cuphoneo_boton_canjear'); ?>" data-id="<?php echo $valor->item_id; ?>" /> <?php } } } ?> </div>
Comments
Post a Comment