Support the ongoing development of Laravel.io →
posted 7 years ago
Laravel

So i try to make popup with http://t4t5.github.io/sweetalert/ in html i make:

                            <button class='btn btn-xs btn-danger delete-button'
                                    onclick="deleteDomain('test {{$domain->domain_name}}?',{{$domain->id}},{{$domain->second}})">
                                DELETE
                            </button>

and in js: ``` function deleteDomain(msg,networkId,domainId) { swal({ title: "Are you sure??", text: msg, type: "warning", showCancelButton: true, confirmButtonColor: "#

                    confirmButtonText: "Del!!",
                    cancelButtonText: "No!!",
                    closeOnConfirm: true,
                    closeOnCancel: true
                },
                function (isConfirm) {
                    if (isConfirm) {
                    document.location.href="{!! route('domains.destroy',[networkId,domainId]) !!}";
                    }
                });
        };

and i have two errors one is in line

                    document.location.href="{!! route('domains.destroy',[networkId,domainId]) !!}";

Use of undefined constant networkId - assumed 'networkId' and second when i try to pass data in:

                                    onclick="deleteDomain('test {{$domain->domain_name}}?',{{$domain->id}},{{$domain->second}})">

i have errors expression exception beetwen , and {{$domain->id}} what should i do?

Last updated 3 years ago.
0

edit your question, it's not readable.

0

What You can do is to define a hidden field like this:

<input type="hidden" id='myURL' value="{{url('my/url')}}">

use the '#id' to access the url.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

dekros dekros dekros Joined 22 Jun 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.