Filtrowanie wierszy tabeli – dopasowanie do 2 kolumn
Kategoria: Ajax
Ajax – cakephp4 – onKeyUp – wyszukiwanie projektów po nazwie
Wyszukiwanie projektów po numerze (ciąg znaków) Ajax Czytaj dalej Ajax – cakephp4 – onKeyUp – wyszukiwanie projektów po nazwie
Twitter API
Narzędzia: https://www.postman.com
API walutomat.pl
Należy utworzyć konto w serwisie następnie wygenerować API key.
Endpoint API: https://api.walutomat.pl/api/v2.0.0/
-
- market_fx/best_offers (bez api key)
- direct_fx/rates – wymagany klucz API
ajaxSetup
Ustawienia wspólne dla wielu wywołań ajax
$.ajaxSetup({ url : '/projekty/add.json', type : 'post', dataType : 'json', error : function(e){ console.error(e.message); } }); $.ajax({ url : '/projekty/edit.json', // nadpisuje ust. ogólne data : JSON.stringify({id, name}), success : function(resp ){ render(resp); } });
Ajax – PHP – rezerwacje
Przykład obsługi rezerwacji po obu stronach – klient serwer
Ajax Headers
Typowy Request jQuery Ajax
var url = '/controller/action.json' var data_obj = { ulica : 'Marszałkowska', miasto : 'Warszawa' }; data = JSON.stringify( data_obj ); $.ajax({ type : 'post', dataType : 'json', data : data, url : url, success : function(response) { renderResult(response); }, error : function(e) { alert( e.message ); } });
Ustawianie nagłówków dla Request
$.ajax({ beforeSend : function(xhr) { xhr.setRequestHeader('X-Test-Hdr', 'Test'); }, headers: { 'header1': 'value1', 'header2': 'value2' }, contentType: 'application/json; charset=utf-8', });
Domyślny nagłówek dla żądań AJAX
X-Requested-With: XMLHttpRequest
xhrobj.setRequestHeader("X-Requested-With", "XMLHttpRequest");