Basic Usages

DOMOPS API
  • setContent

    Sets the content of an element.

  • appendContent

    Insert content as the last child of specified element.

  • prependContent

    Insert content as the first child of specified element.

  • insertAfter

    Insert content after specified element.

  • insertBefore

    Insert content before specified element.

  • remove

    Remove specified element and its children.

  • replace

    Replace specified element with content.

  • eval

    Evaluates JavaScript code represented as a string.

namespace App\Http\Controllers;

use App\Models\User;
use dobron\BigPipe\AsyncResponse;

class UsersController extends Controller
{
    private $response;

    public function __construct(AsyncResponse $response)
    {
        $this->response = $response;
    }

    public function loadMore(Request $request)
    {
        ...

        $this->response->appendContent('#users > tbody', view('app.users.partials.table-body', compact('users')));

        return $this->response->send();
    }
}

Examples

  • 82%

    178

    Orders

    16%

    170

    Users

    Request with Interval

    If it is not possible to use the ajaxify attribute, you can use AsyncRequest & AsyncResponse methods to do the same thing.

  • John Doe
    Home
    Jane Doe
    Work

    Click Interaction

    In this example, we use the ajaxify and rel attributes. They respond to the click event which calls AsyncRequest and displays the phone number.

  • Call JS Module from PHP

    It is not always appropriate to use DOMOPS. You can call a specific class method or a regular function with the custom arguments.

Github