(07-19-2017, 05:12 AM)Junie Wrote: (07-19-2017, 01:49 AM)Martin7483 Wrote: Remove the enctype="multipart/form-data" attribute from the opening form tag
That attribute is only needed when uploading files.
I missed this up untill now, but that indeed could be the cause.
If you do require uploading files in the future, you will need to do this;
Code:
function save(form) {
// NO!!! Don't do this!
var formData = $(form).serialize();
// YES!!! Do this!
var formData = new FormData(form);
$.ajax({
url: url,
type: "POST",
data: formData,
dataType: "JSON",
......
......
}
Sir,
But for now, I just need input text and removing the enctype="multipart/form-data" doesn't change anything. My idea of creating a one-page CRUD in codeigniter seems too hard for a beginner. If I can't correct the errors I may use the modal way but as this moment I will stick on one-page crud.
Thanks for the TIME.
1. new FormData(form); is the new way, but the old way do it too (.serialize())
2. the ajax method does not know about multipart/form-data. It does not care about it.
You have only one problem. you does not know how to debug you code
Use the developer console. Every browser has a developer console.
if you send the ajax request, check the developer console. In the network tab you see an entry. Make a screenshot from it.