javascript - JQuery AJax Result Echo PHP -
i must check result of ajax same php variable value. there anyway this?
thank in advance help.
my ajax html:
<?php $x = '<p id="ip"></p>'; $y = '2_2_1_3'; if($x == $y){ echo $x; } ?> <a id="input" href="#">get value<input type="hidden" value="2_2_1_3"></a> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script> jquery(document).ready(function(){ $("#input").on("click", function(){ $.ajax({ type: 'post', url: "ip2.php", data:'ip=' + $(this).parent().find('input').val(), success: function(data){ $("#ip").html(data); } }); }); }); </script>
the php script:
<?php if($_post['ip'] >= 0){ $ip = $_post['ip']; echo $ip; } ?>
$x = '<p id="ip"></p>'; $y = '2_2_1_3'; if($x == $y){ // never true because $x diferent of $y echo $x; //so never print out }
and won't have element id="ip" print result ajax
success: function(data){ $("#ip").html(data); }
for work try this:
<?php $x = '<p id="ip"></p>'; $y = '2_2_1_3'; echo $x; ?>
Comments
Post a Comment