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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -