Ajax: Unterschied zwischen den Versionen

Aus Flinkwiki
Wechseln zu: Navigation, Suche
(Links)
K
Zeile 3: Zeile 3:
 
Asynchronous JavaScript And XML
 
Asynchronous JavaScript And XML
  
 +
https://de.wikibooks.org/wiki/Websiteentwicklung:_AJAX:_Erstes_Programm
  
 
+
----
  
 
== XMLHttpRequest ==
 
== XMLHttpRequest ==

Version vom 30. Oktober 2018, 12:49 Uhr


Asynchronous JavaScript And XML

https://de.wikibooks.org/wiki/Websiteentwicklung:_AJAX:_Erstes_Programm


XMLHttpRequest

XMLHttpRequest ist ein JavaScript Objekt, das von Microsoft entwickelt und von Mozilla, Apple, und Google übernommen wurde. Es wird derzeit im W3C standardisiert. Es bietet einen einfachen Weg, Daten von einem URL zu erhalten. Trotz seines Namens kann man mit XMLHttpRequest jede Art von Daten laden, nicht nur XML, und es unterstützt auch andere Protokolle als HTTP (inklusive file und ftp). Eine Instanz von XMLHttpRequest erzeugt man ganz einfach so:

var myRequest = new XMLHttpRequest();[1]


XMLHttpRequest.readyState

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState


Ajax in WordPress

add_action( 'wp_enqueue_scripts', 'ajax_test_enqueue_scripts' );
function ajax_test_enqueue_scripts() {
	if( is_single() ) {
		wp_enqueue_style( 'love', plugins_url( '/love.css', __FILE__ ) );
	}

	wp_enqueue_script( 'love', plugins_url( '/love.js', __FILE__ ), array('jquery'), '1.0', true );

	wp_localize_script( 'love', 'postlove', array(
		'ajax_url' => admin_url( 'admin-ajax.php' )
	));

}



Links



| | |