Quantcast
Channel: How to call a php function from ajax? - Stack Overflow
Viewing all articles
Browse latest Browse all 6

Answer by Rajendra Rajput for How to call a php function from ajax?

$
0
0

jquery:

$(document).ready(function(){    $('#tfa_1117700').change(function(){        var inputValue = $(this).val();        var v_token = "{{csrf_token()}}";        $.post("{{url('/each-child')}}",            { dropdownValue: inputValue,_token:v_token },            function(data){                console.log(data);                $('#each-child-html').html(data);            }        );    });});

php:

public function EachChild(Request $request){    $html ="";    for ($i=1; $i <= $request->dropdownValue; $i++)    {         $html = $i;    }    echo $html;}

Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>