Welcome Guest, Not a member yet? Register   Sign In
How to check existing data with jquery validation library with codeigniter 4 csrf?
#2

(This post was last modified: 01-15-2021, 08:05 PM by iRedds.)

God, how did you get to this age?  Big Grin

I hope this is just a sample code. But if you are using database queries in the controller this is a bad practice and a violation of the MVC pattern.
Use the model to work with the database.

1. Use ->countAllResults() instead of ->get()->getResult();
2. When you make a POST request with CSRF enabled, the hash changes. For each subsequent request, you must use a new hash. Since you don't, you will receive an HTTP 403 error.
3. Check out the manual for the json_encode function. And you will understand what you are doing wrong.(Hello HTTP 500 error)
https://www.php.net/manual/en/function.json-encode.php

And if you fully use the framework, then it is better to read the documentation on this topic
https://codeigniter.com/user_guide/outgo...the-output
Reply


Messages In This Thread
RE: How to check existing data with jquery validation library with codeigniter 4 csrf? - by iRedds - 01-15-2021, 08:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB