php - Use textbox text in jQuery AJAX request -
i'm trying send request php form (using get) dynamically generated based on textbox field user types in. i've tried few things can't manage value of textbox.
<script> $("#mydiv").on('click', 'p', function(){ setinterval(function() { $.ajax({url:"val",success:function(result){ $("#mydiv").html(result); }}); },1000); }); </script>
if leave this, works , sends request "val", i'm not sure how put value of textbox in there. still within same div, dynamically loaded after page has been loaded completely.
any appreciated.
var val = $("#id-of-textbox").val();
replace #id-of-textbox
actual id of textbox , var val
contain text value of textbox.
you'll send ajax request so:
$.ajax({url:"val", data: { value: val }, success: function...
Comments
Post a Comment