01 form 轉 URL, $(“form”).serialize()

https://js.do/powenko/form-serialize


<!DOCTYPE html> 
<html> 
    <head> 
        <title>serialize Method</title> 
        <script src= 
        "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> 
        </script> 
          
        <!-- jQuery code to show the working of this method -->
        <script> 
            $(document).ready(function() { 
                $("button").click(function() { 
                    $("#d").text($("form").serialize()); 
                }); 
            }); 
        </script> 
        <style> 
            #d1 { 
                width: 300px; 
                height: 100px; 
                padding: 20px; 
                border: 2px solid green; 
                margin-bottom: 10px; 
            } 
        </style> 
    </head> 
    <body> 
        <div id="d1"> 
            <form action=""> 
                Site Name: 
                <input type="text" name="SiteName" value="GeeksforGeeks"> 
                <br> 
                <br> Contributor name: 
                <input type="text" name="ContributorName" value="geeks"> 
                <br> 
            </form> 
            <!-- click on this button -->
            <button>Click here!</button> 
        </div> 
        <div id="d"></div> 
    </bo
javascript
01 String 字串CH04 ArrayCH05 FormCH05 時間日期Ch10 AJAX