Skip to main content

Develop ajax based analytical dashboard without writing any javascript.

Project description

## About This
As a datascientist you may dont want to write any javascript. This will help you to build ajax callback without writing any javascript. Script is very simple and too small and works like a charm.

I build this script to plot graph dynamically using ajax but you can use this for anything you need for ajax call.

## Flask integration
### app.py
from flask import Flask, jsonify, render_template, request, url_for
import pyajax

app = Flask(__name__)

@app.route("/")
def index():
config = [{
'handler':{
'event':{'url':'/ajaxname','target':'submit','method':'click'},
'input':{'name':'name'},
'action':{'output':'output'}
}
}]
script = pyajax.buildscript(config)
return render_template('index.html', script=script)

@app.route("/ajaxname")
def ajaxname():
return jsonify(output=request.args.get('name'))

if __name__ == '__main__':
app.run()

### index.html

<!doctype html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
{% block javascript %}{% endblock %}
</head>
<body>
<div><input type="text" id="name" /> <input type="submit" id="submit" value="submit"/></div>
<div>My Name: <span id="output">?</span></div>
</body>
</html>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyajax-0.0.5.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyajax-0.0.5-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file pyajax-0.0.5.tar.gz.

File metadata

  • Download URL: pyajax-0.0.5.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for pyajax-0.0.5.tar.gz
Algorithm Hash digest
SHA256 eb10eede95f384d17f2688adc1f2d41b40cb2e8f587f3732f692be527d425ffb
MD5 711b5d783690cd888bc784955aea810b
BLAKE2b-256 f03f6b5017b757e7a850c8540a1fa3f5c086d820e6ed63a291163e694713d81d

See more details on using hashes here.

File details

Details for the file pyajax-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pyajax-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for pyajax-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 fba54543bb60f225be91a43e609234c58e83d6ea2b11f51d166480b8b8c96f20
MD5 4cb2ac1ccee9a99971df45dbc37cc2c2
BLAKE2b-256 80a70f90e21f5aff4d07baa48f4c8f31a33a85bd5aa12be4347cfa21bfed2962

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page