GitHub

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. Deprecated: call a JavaScript module instead.

Controller.php
namespace App\Http\Controllers;

use App\Arch\BigPipe\AsyncResponse;

class PostController extends Controller
{
    public function loadMore(Request $request)
    {
        ...

        return (new AsyncResponse())
            ->appendContent('#posts', view('posts.items', compact('posts'))->render())
            ->send();
    }
}
Try it
Orders
159
+60%
Users
63
+54%

a request every 2.5 s

A request on an interval

Where the ajaxify attribute does not fit, AsyncRequest sends the request from JavaScript; the response replaces the numbers with setContent.

JD John DoeHome +••• •• 84
JD Jane DoeWork +••• •• 11

A click that replaces the link

The ajaxify and rel attributes send the request; the response replaces the clicked link with the number.

A JavaScript module called from PHP

Not everything is a DOM operation: the response calls the set() method of tutorial/Image with a URL.