python - Flask: using JSON to return value of attribute -


i'd return 'value' attribute following link:

<li><a href="/disable?server={{counter + loop.index0}}" id="count" value="{{ counter + loop.index0 }}">click disable </a></li> 

js:

<script type=text/javascript>  $(function() {   $('#count').bind('click', function(){     $.ajax({         method: "post",         url: "{{ url_for('disablebtn') }}",         datatype: 'json',         data: { count: $("#count").attr("value");}     })     .done(function(data){     alert("value = " + data);         });     }); }); </script> 

in app.py file have:

@app.route('/disable', methods=['get', 'post']) def disablebtn():     valueofbutton = request.json['count']     return jsonify(data = valueofbutton) 

how can return 'value' attribute same template link in , able use int index of array?


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -