Support the ongoing development of Laravel.io →
Requests Input Forms
Last updated 1 year ago.
0

Looking over the code, you appear to have something that should be working. Using your browser's debug tools, is the AJAX request logged in the console? Is Laravel returning a response with the customer records? Or is it just not displaying in the DOM after the results are returned?

Last updated 1 year ago.
0

Laravel is giving an error that $customers is not set when loading the view. Am I passing this the wrong way?

Last updated 1 year ago.
0

First thing I noticed is, the way you are getting entry

$entry = $_POST['email'];

This might be wrong, you need to write it like,

$entry = Input::get('email');

One more thing is, you will get $customers in your data variable in javascript upon success, You need parse it there and use then. Check the code below! I was facing same problem. I removed dataType: "json", and it worked. Refer code given below. It is working for me!

$.ajax({
type: 'POST',
                url: "Your_URL",
                data: new FormData($('.form')[0]),
                processData: false,
                contentType: false,
                success: function(output) {
                    console.log(output);
                    if (output == 'success') 
                        successHandler2.show();
                    else {
					//Show error
                    }
                },
                error: function(data) {
                    //Show error
                }
				});

If this code does'nt work then change

data: new FormData($('.form')[0])  

to

data: new FormData($('#yourformid')[0])

All the best!

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ralanyo ralanyo Joined 6 Feb 2014

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.

© 2024 Laravel.io - All rights reserved.