Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

JQuery datatable with ajax, post API call hook

$(async function() {
    $('#registry_table').DataTable({
        serverSide: true,
        ajax: {
            url: 'localhost:3000/provenance/registries',
            headers: {
                'Content-Type': 'application/json',
                'Authorization': 'Bearer ' + localStorage.getItem("token")
            },
            data: () => {
               return {page: 0, per_page: 5};
            }
        },
        columns: [
            {data: 'name', defaultContent: 'N/A'},
            {data: 'created', defaultContent: 'N/A'},
            {data: 'extrinsic', defaultContent: 'N/A'},
            {data: 'registry', defaultContent: ' <span class="text-primary bg-white fa-border d-inline-block" style="cursor: pointer" title="Rename Registry"><i class="fas fa-pen-nib"/> Rename</span>'}
        ],
        language: {
            searchPlaceholder: "Search...",
            search: "",
            lengthMenu: "_MENU_ &nbsp;items/page"
        }
    });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: button disappears after click javascript 
Javascript :: how to generate random text in vue js 
Javascript :: [Homepage] is not a <Route component. All component children of <Routes must be a <Route or <React.Fragment 
Javascript :: javascript string repeat 
Javascript :: js fetch status of 500 
Javascript :: import npm module node.js 
Javascript :: how to prevent xss attacks in node js 
Javascript :: how to concatenate a string in javascript 
Javascript :: javascript check table not empty 
Javascript :: momentjs docs 
Javascript :: dull or blur a background image in react native 
Javascript :: javascript import class 
Javascript :: js html editor 
Javascript :: javascript add item to list 
Javascript :: jquery vertical scroll 
Javascript :: overflowx javascript 
Javascript :: points in three js 
Javascript :: get data from google sheets javascript 
Javascript :: variables javascript 
Javascript :: html form data to json 
Javascript :: ejs render 
Javascript :: Factorial Recursion Function in Javascript 
Javascript :: show image javascript 
Javascript :: mean stack tutorial 
Javascript :: jquery add css important 
Javascript :: pass setstate to child 
Javascript :: query string to object javascript 
Javascript :: export aab bundle react native android 
Javascript :: js push object in array 
Javascript :: peerjs 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =