Welcome Guest, Not a member yet? Register   Sign In
Cannot get AJAX to work for Post/Create
#6

(This post was last modified: 06-05-2022, 02:50 AM by spreaderman.)

(06-05-2022, 12:18 AM)iRedds Wrote:
(06-04-2022, 11:59 PM)InsiteFX Wrote: Your ajax url is wrong try this one.

Code:
url: "<?= base_url('admin/tasks/create');?>",

url correct.

'/admin/tasks/create' is a relative path and will use the domain of the loaded page.

for page https://domain/some/page, '/admin/tasks/create'  -> https://domain/admin/tasks/create

Thanks. Even if I put in the full path, like "https://www.example.com/admin/tasks/create" I get the same thing.

If i log console.log(data); I see this;

{success: false, msg: 'There are some validation errors'}

But it give that back regardless of whether I pass validation or not I think.

(06-05-2022, 02:49 AM)spreaderman Wrote:
(06-05-2022, 12:18 AM)iRedds Wrote:
(06-04-2022, 11:59 PM)InsiteFX Wrote: Your ajax url is wrong try this one.

Code:
url: "<?= base_url('admin/tasks/create');?>",

url correct.

'/admin/tasks/create' is a relative path and will use the domain of the loaded page.

for page https://domain/some/page, '/admin/tasks/create'  -> https://domain/admin/tasks/create

Thanks.  Even if I put in the full path, like "https://www.example.com/admin/tasks/create" I get the same thing.

If i log console.log(data); I see this;

{success: false, msg: 'There are some validation errors'}

But it give that back regardless of whether I pass validation or not I think.

And I cannot seem to catch the form data.
Reply


Messages In This Thread
RE: Cannot get AJAX to work for Post/Create - by spreaderman - 06-05-2022, 02:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB