php - Why AJAX is passing null / empty value? -
hi guys need on issue. managed input value modal form, when try check response show null/empty value.
how can solve this, research on other related questions still cannot solved. attached screenshot + code
here ajax code :
$(function() { $('#tag-form-submit').on('click', function(e) { var d3_ca = $('#mymodal').find("textarea[name='d3_ca']").val(); console.log(d3_ca); e.preventdefault(); $.ajax({ type: "post", url: "d3handler.php", data: {d3_ca:d3_ca}, success: function(response) { $('#mymodal').find("textarea[name='d3_ca']").val(''); $('#test').html(response); $(".modal").modal('hide'); }, error: function() { alert('error');} }); return false; }); });
here php code :
if(isset($_post['d3_ca'])) { $t = $_post['d3_ca']; echo $t; if($t === 'aaa') { echo 'yes correct value same'; } else { echo 'value not same'; } } else if ($_post['d3_ca'] == '') { echo 'get empty value ajax'; }
Comments
Post a Comment