Python+flask+ajxa

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.