jQuery get() Method - W3Schools

文章推薦指數: 80 %
投票人數:10人

Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, ... Tutorials References Exercises Videos ProNEW Menu Login PaidCourses WebsiteNEW HTML CSS JAVASCRIPT SQL PYTHON PHP BOOTSTRAP HOWTO W3.CSS JAVA JQUERY C++ C# R React Kotlin    Darkmode Darkcode × Tutorials HTMLandCSS LearnHTML LearnCSS LearnRWD LearnBootstrap LearnW3.CSS LearnColors LearnIcons LearnGraphics LearnSVG LearnCanvas LearnHowTo LearnSass DataAnalytics LearnAI LearnMachineLearning LearnDataScience LearnNumPy LearnPandas LearnSciPy LearnMatplotlib LearnStatistics LearnExcel XMLTutorials LearnXML LearnXMLAJAX LearnXMLDOM LearnXMLDTD LearnXMLSchema LearnXSLT LearnXPath LearnXQuery JavaScript LearnJavaScript LearnjQuery LearnReact LearnAngularJS LearnJSON LearnAJAX LearnAppML LearnW3.JS Programming LearnPython LearnJava LearnC LearnC++ LearnC# LearnR LearnKotlin LearnGo ServerSide LearnSQL LearnMySQL LearnPHP LearnASP LearnNode.js LearnRaspberryPi LearnGit LearnAWSCloud WebBuilding CreateaWebsiteNEW WhereToStart WebTemplates WebStatistics WebCertificates WebDevelopment CodeEditor TestYourTypingSpeed PlayaCodeGame CyberSecurity Accessibility DataAnalytics LearnAI LearnMachineLearning LearnDataScience LearnNumPy LearnPandas LearnSciPy LearnMatplotlib LearnStatistics LearnExcel LearnGoogleSheets XMLTutorials LearnXML LearnXMLAJAX LearnXMLDOM LearnXMLDTD LearnXMLSchema LearnXSLT LearnXPath LearnXQuery × References HTML HTMLTagReference HTMLBrowserSupport HTMLEventReference HTMLColorReference HTMLAttributeReference HTMLCanvasReference HTMLSVGReference GoogleMapsReference CSS CSSReference CSSBrowserSupport CSSSelectorReference Bootstrap3Reference Bootstrap4Reference W3.CSSReference IconReference SassReference JavaScript JavaScriptReference HTMLDOMReference jQueryReference AngularJSReference AppMLReference W3.JSReference Programming PythonReference JavaReference ServerSide SQLReference MySQLReference PHPReference ASPReference XML XMLDOMReference XMLHttpReference XSLTReference XMLSchemaReference CharacterSets HTMLCharacterSets HTMLASCII HTMLANSI HTMLWindows-1252 HTMLISO-8859-1 HTMLSymbols HTMLUTF-8 × ExercisesandQuizzes Exercises HTMLExercises CSSExercises JavaScriptExercises SQLExercises MySQLExercises PHPExercises PythonExercises NumPyExercises PandasExercises SciPyExercises jQueryExercises JavaExercises C++Exercises C#Exercises RExercises KotlinExercises GoExercises BootstrapExercises Bootstrap4Exercises Bootstrap5Exercises GitExercises Quizzes HTMLQuiz CSSQuiz JavaScriptQuiz SQLQuiz MySQLQuiz PHPQuiz PythonQuiz NumPyQuiz PandasQuiz SciPyQuiz jQueryQuiz JavaQuiz C++Quiz C#Quiz RQuiz XMLQuiz CyberSecurityQuiz BootstrapQuiz Bootstrap4Quiz Bootstrap5Quiz AccessibilityQuiz Courses HTMLCourse CSSCourse JavaScriptCourse FrontEndCourse SQLCourse PHPCourse PythonCourse NumPyCourse PandasCourse DataAnalyticsCourse jQueryCourse JavaCourse C++Course C#Course RCourse XMLCourse CyberSecurityCourse AccessibilityCourse Certificates HTMLCertificate CSSCertificate JavaScriptCertificate FrontEndCertificate SQLCertificate PHPCertificate PythonCertificate DataScienceCertificate Bootstrap3Certificate Bootstrap4Certificate jQueryCertificate JavaCertificate C++Certificate ReactCertificate XMLCertificate × Tutorials References Exercises PaidCourses Spaces Videos Shop Pro jQueryTutorial jQueryHOME jQueryIntro jQueryGetStarted jQuerySyntax jQuerySelectors jQueryEvents jQueryEffects jQueryHide/Show jQueryFade jQuerySlide jQueryAnimate jQuerystop() jQueryCallback jQueryChaining jQueryHTML jQueryGet jQuerySet jQueryAdd jQueryRemove jQueryCSSClasses jQuerycss() jQueryDimensions jQueryTraversing jQueryTraversing jQueryAncestors jQueryDescendants jQuerySiblings jQueryFiltering jQueryAJAX jQueryAJAXIntro jQueryLoad jQueryGet/Post jQueryMisc jQuerynoConflict() jQueryFilters jQueryExamples jQueryExamples jQueryQuiz jQueryExercises jQueryCertificate jQueryReferences jQueryOverview jQuerySelectors jQueryEvents jQueryEffects jQueryHTML/CSS jQueryTraversing jQueryAJAX jQueryMisc jQueryProperties jQueryget()Method ❮jQueryAJAXMethods Example SendanHTTPGETrequesttoapageandgetaresultback: $("button").click(function(){  $.get("demo_test.asp",function(data,status){     alert("Data:"+data+"\nStatus:"+status);   }); }); TryitYourself» DefinitionandUsage The$.get()methodloadsdatafromtheserverusingaHTTPGETrequest. Examples Request"test.php",butignorereturnresults: $.get("test.php"); Request"test.php"andsendsomeadditionaldataalongwiththerequest (ignorereturnresults): $.get("test.php",{name:"Donald",town:"Ducktown"}); Request"test.php"andpassarraysofdatatotheserver(ignorereturn results): $.get("test.php",{'colors[]':["Red","Green","Blue"]}); Request"test.php"andalerttheresultoftherequest: $.get("test.php",function(data){  alert("Data:"+data); }); Syntax $.get(URL,data,function(data,status,xhr),dataType) Parameter Description URL Required.SpecifiestheURLyouwishtorequest data Optional.Specifiesdatatosendtotheserveralongwiththerequest function(data,status,xhr) Optional.Specifiesafunctiontoruniftherequestsucceeds Additionalparameters: data-containstheresultingdatafromtherequest status-containsthestatusoftherequest("success","notmodified","error","timeout",or"parsererror") xhr-containstheXMLHttpRequestobject dataType Optional.Specifiesthedatatypeexpectedoftheserverresponse. BydefaultjQueryperformsanautomaticguess. Possibletypes: "xml"-AnXMLdocument "html"-HTMLasplaintext "text"-Aplaintextstring "script"-RunstheresponseasJavaScript,andreturnsitasplaintext "json"-RunstheresponseasJSON,andreturnsaJavaScriptobject "jsonp"-LoadsinaJSONblockusingJSONP.Willaddan"?callback=?"totheURLtospecifythecallback ❮jQueryAJAXMethods NEW WejustlaunchedW3Schoolsvideos Explorenow COLORPICKER Getcertifiedbycompletingacoursetoday! w3schoolsCERTIFIED.2022 Getstarted CODEGAME PlayGame



請為這篇文章評分?