Ajax data from controller |
Based on your code above, I can't see why you need to refresh the page. It looks for a post value, and then echos the data back to your AJAX. Do you get an error message or what? Why do you need to press F5?
1. Some libraries use a JavaScript template that they append the returned json into. And replacing the whole #container 2. Or you can just do like you said. Append it to existing html elements. #firstName #lastName... 3. Or return generated html based on a CI view. (I'm doing this in a project) Here's an example I wrote earlier regarding submitting and returning pure json (step 2) or formatted html (step 3). You need to add the replacing code yourself ("success"). https://forum.codeigniter.com/thread-703...#pid352422 |
Messages In This Thread |
Ajax data from controller - by scott3322 - 03-27-2018, 10:21 AM
RE: Ajax data from controller - by jreklund - 03-27-2018, 11:50 AM
RE: Ajax data from controller - by scott3322 - 03-28-2018, 08:17 AM
RE: Ajax data from controller - by jreklund - 03-28-2018, 11:31 AM
RE: Ajax data from controller - by scott3322 - 03-28-2018, 12:07 PM
RE: Ajax data from controller - by InsiteFX - 03-28-2018, 08:20 PM
RE: Ajax data from controller - by jordi_1h - 04-28-2020, 07:37 PM
|