{"id":743,"date":"2013-05-23T13:30:52","date_gmt":"2013-05-23T12:30:52","guid":{"rendered":"http:\/\/www.bocciolesi.fr\/tutoriels-et-cours\/?p=743"},"modified":"2017-02-24T14:56:50","modified_gmt":"2017-02-24T13:56:50","slug":"jquery-ajax","status":"publish","type":"post","link":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/","title":{"rendered":"JQUERY &#8211; Ajax"},"content":{"rendered":"<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-top-right\"><a href=\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/posts\/743?print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/plugins\/pdf-print\/images\/pdf.png\" alt=\"image_pdf\" title=\"Afficher le PDF\" \/><span class=\"pdfprnt-button-title pdfprnt-button-pdf-title\">Enregistrer en PDF<\/span><\/a><a href=\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/posts\/743?print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\"><\/a><\/div><p><span style=\"color: #3366ff;\"><strong>I\u25ba Dans cet article, nous allons aborder les fonction jQuery.ajax ou $.ajax | $.get | $.post | $.getJSON<\/strong><\/span><\/p>\n<p>Voici un exemple de\u00a0traitement\u00a0Ajax classique .. en\u00a0javascript\u00a0\u00e9videmment<\/p>\n<p><a href=\"https:\/\/www.mb-creation-web.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture8.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-749\" src=\"https:\/\/www.mb-creation-web.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture8.jpg\" alt=\"Capture\" width=\"834\" height=\"388\" srcset=\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture8.jpg 834w, https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture8-300x139.jpg 300w, https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture8-624x290.jpg 624w\" sizes=\"auto, (max-width: 834px) 100vw, 834px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Voici le m\u00eame traitement en Ajax jQuery<\/p>\n<p><a href=\"https:\/\/www.mb-creation-web.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture10.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-755\" src=\"https:\/\/www.mb-creation-web.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture10.jpg\" alt=\"Capture\" width=\"893\" height=\"709\" srcset=\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture10.jpg 893w, https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture10-300x238.jpg 300w, https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture10-624x495.jpg 624w\" sizes=\"auto, (max-width: 893px) 100vw, 893px\" \/><\/a><\/p>\n<p>La fonction <strong><span style=\"color: #3366ff;\">ajax<\/span> <\/strong>admet plusieurs attributs dont :<\/p>\n<ol>\n<li><span style=\"line-height: 1.714285714; font-size: 1rem;\">La page sollicit\u00e9e par la requete (url)<\/span><\/li>\n<li><span style=\"line-height: 1.714285714; font-size: 1rem;\">Le type de requ\u00eate POST | GET | PUT | DELETE<\/span><\/li>\n<li>Les donn\u00e9es s\u00e9rialis\u00e9es \u00e0 envoyer \u00e0 la page concern\u00e9e par la requ\u00eate<\/li>\n<li>le CallBack de succ\u00e8s<\/li>\n<li>Le CallBack en cas d&#8217;erreur<\/li>\n<li>Le type de donn\u00e9es que l&#8217;on attend du serveur : HTML | XML | JSON<\/li>\n<\/ol>\n<p>Les fonctions<strong><span style=\"color: #3366ff;\"> get<\/span><\/strong> et <strong><span style=\"color: #3366ff;\">post<\/span> <\/strong>sont des alias de <strong><span style=\"color: #3366ff;\">ajax<\/span> <\/strong>mais poss\u00e8dent \u00e9videmment un type de requ\u00eate pr\u00e9d\u00e9fini, elles se construisent comme suit : <strong><span style=\"color: #3366ff;\">$.get(url, param\u00e8tres) ou $.post(url, param\u00e8tres)<\/span><\/strong><br \/>\nExemple :<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #3366ff;\">$(&#8216;#bouton&#8217;).click(function() {<\/span><\/p>\n<p style=\"padding-left: 120px;\"><span style=\"color: #800080;\"> $.get(&#8216;fichier.htm&#8217;, function(data) {<\/span><br \/>\n<span style=\"color: #800080;\"> $(&#8220;#boite&#8221;).append(data);<\/span><br \/>\n<span style=\"line-height: 1.714285714; font-size: 1rem; color: #800080;\">});<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #3366ff;\">});<\/span><\/p>\n<p>La fonction getJSON permet de r\u00e9cup\u00e9rer des fichiers dont le datatype est du JSON, pour info reportez vous \u00e0 l&#8217;article :\u00a0<a href=\"https:\/\/www.mb-creation-web.fr\/tutoriels-et-cours\/json-javascript-object-notation\/\" target=\"_blank\">https:\/\/www.mb-creation-web.fr\/tutoriels-et-cours\/json-javascript-object-notation\/<\/a><\/p>\n<p>Voici un exemple :<\/p>\n<p><a href=\"https:\/\/www.mb-creation-web.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture11.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-756\" src=\"https:\/\/www.mb-creation-web.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture11.jpg\" alt=\"Capture\" width=\"827\" height=\"511\" srcset=\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture11.jpg 827w, https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture11-300x185.jpg 300w, https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture11-624x385.jpg 624w\" sizes=\"auto, (max-width: 827px) 100vw, 827px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Le fichier.php :<\/p>\n<p><a href=\"https:\/\/www.mb-creation-web.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture22.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-757\" src=\"https:\/\/www.mb-creation-web.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture22.jpg\" alt=\"Capture2\" width=\"454\" height=\"287\" srcset=\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture22.jpg 454w, https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/05\/Capture22-300x189.jpg 300w\" sizes=\"auto, (max-width: 454px) 100vw, 454px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><em>Michel BOCCIOLESI<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u25ba Dans cet article, nous allons aborder les fonction jQuery.ajax ou $.ajax | $.get | $.post | $.getJSON Voici un exemple de\u00a0traitement\u00a0Ajax classique .. en\u00a0javascript\u00a0\u00e9videmment &nbsp; Voici le &#8230;<\/p>\n","protected":false},"author":1,"featured_media":1626,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,33,39],"tags":[],"class_list":["post-743","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developpement-web","category-jquery","category-tutoriels"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JQUERY - Ajax - Tutoriels et Cours<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JQUERY - Ajax - Tutoriels et Cours\" \/>\n<meta property=\"og:description\" content=\"I\u25ba Dans cet article, nous allons aborder les fonction jQuery.ajax ou $.ajax | $.get | $.post | $.getJSON Voici un exemple de\u00a0traitement\u00a0Ajax classique .. en\u00a0javascript\u00a0\u00e9videmment &nbsp; Voici le ...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutoriels et Cours\" \/>\n<meta property=\"article:published_time\" content=\"2013-05-23T12:30:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-02-24T13:56:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/07\/html-3.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"767\" \/>\n\t<meta property=\"og:image:height\" content=\"379\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michel BOCCIOLESI\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michel BOCCIOLESI\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/\",\"url\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/\",\"name\":\"JQUERY - Ajax - Tutoriels et Cours\",\"isPartOf\":{\"@id\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/07\/html-3.jpg\",\"datePublished\":\"2013-05-23T12:30:52+00:00\",\"dateModified\":\"2017-02-24T13:56:50+00:00\",\"author\":{\"@id\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/#\/schema\/person\/6bdfe0a1263b803645c69e3d5748dabe\"},\"breadcrumb\":{\"@id\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/#primaryimage\",\"url\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/07\/html-3.jpg\",\"contentUrl\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/07\/html-3.jpg\",\"width\":767,\"height\":379,\"caption\":\"Tutoriels D\u00e9veloppement Web\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JQUERY &#8211; Ajax\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/#website\",\"url\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/\",\"name\":\"Tutoriels et Cours\",\"description\":\"Michel Bocciolesi | Formateur Consultant en Informatique\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/#\/schema\/person\/6bdfe0a1263b803645c69e3d5748dabe\",\"name\":\"Michel BOCCIOLESI\",\"description\":\"Michel Bocciolesi est consultant et formateur sp\u00e9cialis\u00e9 en Informatique.\",\"sameAs\":[\"https:\/\/www.mb-creation-web.fr\"],\"url\":\"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/author\/michel\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JQUERY - Ajax - Tutoriels et Cours","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/","og_locale":"fr_FR","og_type":"article","og_title":"JQUERY - Ajax - Tutoriels et Cours","og_description":"I\u25ba Dans cet article, nous allons aborder les fonction jQuery.ajax ou $.ajax | $.get | $.post | $.getJSON Voici un exemple de\u00a0traitement\u00a0Ajax classique .. en\u00a0javascript\u00a0\u00e9videmment &nbsp; Voici le ...","og_url":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/","og_site_name":"Tutoriels et Cours","article_published_time":"2013-05-23T12:30:52+00:00","article_modified_time":"2017-02-24T13:56:50+00:00","og_image":[{"width":767,"height":379,"url":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/07\/html-3.jpg","type":"image\/jpeg"}],"author":"Michel BOCCIOLESI","twitter_misc":{"\u00c9crit par":"Michel BOCCIOLESI","Dur\u00e9e de lecture estim\u00e9e":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/","url":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/","name":"JQUERY - Ajax - Tutoriels et Cours","isPartOf":{"@id":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/#website"},"primaryImageOfPage":{"@id":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/#primaryimage"},"image":{"@id":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/#primaryimage"},"thumbnailUrl":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/07\/html-3.jpg","datePublished":"2013-05-23T12:30:52+00:00","dateModified":"2017-02-24T13:56:50+00:00","author":{"@id":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/#\/schema\/person\/6bdfe0a1263b803645c69e3d5748dabe"},"breadcrumb":{"@id":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/#primaryimage","url":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/07\/html-3.jpg","contentUrl":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-content\/uploads\/2013\/07\/html-3.jpg","width":767,"height":379,"caption":"Tutoriels D\u00e9veloppement Web"},{"@type":"BreadcrumbList","@id":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/jquery-ajax\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/"},{"@type":"ListItem","position":2,"name":"JQUERY &#8211; Ajax"}]},{"@type":"WebSite","@id":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/#website","url":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/","name":"Tutoriels et Cours","description":"Michel Bocciolesi | Formateur Consultant en Informatique","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"fr-FR"},{"@type":"Person","@id":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/#\/schema\/person\/6bdfe0a1263b803645c69e3d5748dabe","name":"Michel BOCCIOLESI","description":"Michel Bocciolesi est consultant et formateur sp\u00e9cialis\u00e9 en Informatique.","sameAs":["https:\/\/www.mb-creation-web.fr"],"url":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/author\/michel\/"}]}},"_links":{"self":[{"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/posts\/743","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/comments?post=743"}],"version-history":[{"count":10,"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/posts\/743\/revisions"}],"predecessor-version":[{"id":1668,"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/posts\/743\/revisions\/1668"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/media\/1626"}],"wp:attachment":[{"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/media?parent=743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/categories?post=743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bocciolesi.fr\/tutoriels-et-cours\/wp-json\/wp\/v2\/tags?post=743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}