dcyilmaz/formajax

FormAjax converts your forms into forms that submit with ajax without refreshing the page.

Installs: 195

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

v1.0.7 2024-08-26 17:25 UTC

This package is auto-updated.

Last update: 2024-10-26 17:50:55 UTC


README

Total Downloads

FormAjax is a javascript module that automatically submits your forms. In this way, you do not need to write extra xhr codes at the bottom of each page.

Installation

You can install the package via Composer:

Install package

composer require dcyilmaz/formajax

Publish public

php artisan vendor:publish --tag=public --force

Call the file in footer

<script src="{{ asset('vendor/formajax/formajax.js') }}"></script>

Things to watch out for!

Formajax's return type should be response json

{
status= true|false,
message="string"
}

For example, your method that brings a member in laravel should be like this

public function show(string $id)
    {
        $user = User::find($id);
        return response()->json([
            'status' => true,
            'message' => view('admin.users.show', compact('user'))->render()
        ]);
    }

Your status code must be 200 in the return type, otherwise the error confirm alert will warn you. You can modify the javascript file for further settings and editing.