Welcome Guest, Not a member yet? Register   Sign In
How to change the text on a button progamatically?
#12

I'm confused. Does the alert work or not?
If it works, it means your jQuery is ok.
The e in function(e) passes the event of the object you clicked. In this case, the event is running a url. That shouldn't happen, that's why e.preventDefault() will prevent it.

Next step is inserting the AJAX part in the script.
I've already given you an example. Use jQuery's $.post() method.
It must call a controller/method (in CI). You can pass values to it, as shown in the example.
The method must end with an echo statement. The echoed text will be returned as return value to your jQuery script. You can use that to update the danger button.

Good luck.
Reply


Messages In This Thread
RE: How to change the text on a button progamatically? - by Wouter60 - 01-11-2018, 08:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB