AJAX framework

This built-in JavaScript framework provides simple but powerful AJAX capabilities. Check out the calculator example below.

Calculator


  The HTML markup for this example:

<!-- The form -->
<form data-request="onTest" data-request-update="calcresult: '#result'">
    <input type="text" value="15" name="value1">
    <select name="operation">
        <option>+</option>
        <option>-</option>
        <option>*</option>
        <option>/</option>
    </select>
    <input type="text" value="5" name="value2">
    <button type="submit">Calculate</button>
</form>

<!-- The result -->
<div id="result">{% partial "calcresult" %}</div>

  The calcresult partial:

{% if result %}
    The result is {{ result }}.
{% else %}
    Click the <em>Calculate</em> button to find the answer.
{% endif %}

  The onTest PHP code:

function onTest()
{
    $value1 = input('value1');
    $value2 = input('value2');
    $operation = input('operation');

    switch ($operation) {
        case '+' : 
            $this['result'] = $value1 + $value2;
            break;
        case '-' : 
            $this['result'] = $value1 - $value2;
            break;
        case '*' : 
            $this['result'] = $value1 * $value2;
            break;
        default : 
            $this['result'] = $value1 / $value2;
            break;
    }
}

Continue to Plugin components

Exception

Error

We're sorry, but an unhandled error occurred. Please see the details below.

file_put_contents(): Only 0 of 188 bytes written, possibly out of free disk space

/var/www/ssl/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php line 122

     * @param  string  $contents
     * @param  bool  $lock
     * @return int
     */
    public function put($path, $contents, $lock = false)
    {
        return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    }
 
    /**
     * Prepend to a file.
     *
     * @param  string  $path

Stack trace

# Called Code Document Line
7 file_put_contents() ~/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php 122
6 Illuminate\Filesystem\Filesystem->put() ~/vendor/october/rain/src/Filesystem/Filesystem.php 217
5 October\Rain\Filesystem\Filesystem->put() ~/vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php 83
4 Illuminate\Session\FileSessionHandler->write() ~/vendor/laravel/framework/src/Illuminate/Session/Store.php 128
3 Illuminate\Session\Store->save() ~/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php 87
2 Illuminate\Session\Middleware\StartSession->terminate() ~/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php 218
1 Illuminate\Foundation\Http\Kernel->terminateMiddleware() ~/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php 189
0 Illuminate\Foundation\Http\Kernel->terminate() ~/index.php 48