Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

display result in same page using flask api

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>First Flask App</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script></head><script>function myFunction() {
var text1= $('#text1').val();
var text2= $('#text2').val();
  $.ajax({
              url: "/join",
              type: "POST",
              data: {text1:text1,
              text2:text2}          }).done(function(response) {            var html= "<br><br><br><p> <b> RESULT : <b><p>";            response =response.result;
                 $.each(response,function(key,val){
                 console.log(val);
                    html+="<p>"+val+"<p>"                });
                html +="<br>";
                $(".show-data").append(html);
            });
};  </script>
<body>
    <p>
        Taking input from web<br><br>            Text_Value1<input type="text" id="text1" name="text1"><br><br>
            Text_Value2<input type="text" id="text2" name="text2"><br><br>
            <button id="clicked" onclick="myFunction()">Submit</button>
        </p>
    <div class="show-data" >    </div>
</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Python :: how to get the live website html in python 
Python :: dire Bonjour en python 
Python :: random choice without replacement python 
Python :: boto3 with aws profile 
Python :: python know the number of a loop 
Python :: pandas filter rows by value in list 
Python :: codeforces 677a solution 
Python :: value_counts to list 
Python :: read_csv Unnamed: 0 
Python :: pandas add header to existing dataframe 
Python :: python deepcopy 
Python :: numpy replace 
Python :: find nan values in a column pandas 
Python :: change the color of the button on hovering tkinter 
Python :: django all urls 
Python :: scipy correlation 
Python :: how to find location using latitude and longitude in python dataframe 
Python :: write json to file python 
Python :: run file as administrator python 
Python :: micropython network 
Python :: parameter grid 
Python :: python open pickle file 
Python :: savefig resolution 
Python :: semicolons in python 
Python :: python exe not working on other pc 
Python :: narcissistic number python 
Python :: get current time python 
Python :: cv2 videocapture program for python 
Python :: pandas replace column name from a dictionary 
Python :: python sum of natural numbers recursion 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =