Ajxa is a simple value to take.
$.ajax
({type: ' GET ',
URL: $SCRIPT _root + '/add ',
DataType: ' JSON ',
Data: Optional///Submit Server
Success:function (data)
{
}
});
It's a lot of trouble if you take it out, because it's asynchronous. The way to use an incoming function is not to return
function GetValue (success_function)
{
$.ajax ({
Type: ' GET ',
URL: $SCRIPT _root + '/add ',
DataType: ' JSON ',
function GetValue (success_function) {$.ajax ({type: ' GET ', url: $SCRIPT _root + '/add ', DataType: ' JSON ',
Success:function (data) {
Success_function (data); Incoming function
} }); }
And then run it again.
$ (document). Ready (function () {
GetValue (UPDAT1);
});
Finally, we can use data.
function UPDAT1 (name)
{
Name is the data that's coming through, so what do you want to do? But it must be inside this function, you can't return a function headache with return! I can't find a way to StackOverflow.
}
Backstage flask is simple
@app. Route ('/add ')
Def add_numbers ():
A = 1
b = 65
return Jsonify (result = a + b)
Python+flask+ajxa