facing problems with inserting data |
You mean the "Send Now" button - right?
I don't see the "savesms()" method anywhere. While looking for it I notice that you have a controller and model that are both named "sms". You probably shouldn't do that. Perhaps name the model "sms_model". The next problem of note is with using sms_form() with the $.post(... call. $.post(... expects data to be returned by the server but you make a redirect() instead. That's wrong. Echo some data in reply instead. Here's one way but it is presented without knowledge of what happens in "savesms()" so it's maybe not the best solution. PHP Code: public function sms_form() Looking more closely at your <form> I cannot find an <input> for either 'sender' or 'sendscheduletime'. So your $save array will have NULL values for those two items. Just to make sure the "Send Now" button 'click' event is being handled do this test. Code: $("#SendSMS").click(function () {
Yes that's the button. Thank you dave, the Sender should be static like only from one person,how do i achieve this? as for the sendscheduletime it should store the date and time as they are picked, i will change that and tell you how it works
I have no clue as to what the value that represents the "sender" should be. Whatever it is it should be passed from the controller that loads the form view.
I actually found where the problem was, in this code:
$("#SendSMS").click(function () { event.preventDefault(); alert('Send SMS Clicked'); // var postData = $('#SendSMSForm').serializeArray(); // $.post("<?php echo base_url('sms/sms_form') ?>", postData) // .done(function (data) { // alert("Data Loaded: " + data); // }); }); after the function we should have the event defined inside the brackets,such that it looks like this: $("#SendSMS").click(function (event) { event.preventDefault(); alert('Send SMS Clicked'); // var postData = $('#SendSMSForm').serializeArray(); // $.post("<?php echo base_url('sms/sms_form') ?>", postData) // .done(function (data) { // alert("Data Loaded: " + data); // }); }); this returns the alert message
OK, so you removed the "alert('Send SMS Clicked');" line and un-commented the other lines and now the console shows the action?
The click handler should look like this. Code: $("#SendSMS").click(function (event) { Note the first line where 'event' was added to the function
Yes i already did that, am having a syntax error in the controller here:
Code: echo $this->sms->savesms($save) ? "Success" : "Fail"; There seems to be missing something:The error says "syntax error unexpected 'redirect' (T_STRING)"
Remove the redirect call. I have no idea how the redirect('modal_send_sms'); line wound up in my code. It's wrong.
Wait. I do know. I was trying to use 'strikethrough' text formatting on that line. Seems that doesn't work for a code block. Sorry. I've edited the previous post where that appeared. It was supposed to look like this redirect('modal_send_sms');
|
Welcome Guest, Not a member yet? Register Sign In |