I'm trying to implement AJAX Booking Calendar Pro into my Laravel application. (It was purchased from CodeCanyon) I've implemented most of the plugin, I just need to figure out how to connect it to the database so I can save and display the information. I'm using the controller approach. The start of the js file looks like this..
(function($)
{
$.fn.DOPBookingCalendar = function(options)
{
var Data = {'Type':'BackEnd',
'DataURL':'/php/load.php',
'SaveURL':'/php/save.php',
'DayNames':['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
'MonthNames':['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
'AvailableText':'AVAILABLE', // The available text.
'BookedText':'BOOKED', // The Booked text.
'UnavailableText':'NOT AVAILABLE', // The unavailable text.
'DateType':1, // 1: american style; 2: european style;
'PopupDisplayTime':300, // The time for the Pop-Up to Show/Hide
'StatusLabel':'Status', // The text for Availability label.
'PriceLabel':'Price', // The text for Price label.
'Currency':'$', // The currency.
'SubmitBtnText':'Submit', // The text for Submit button.
'ResetBtnText':'Reset', // The text for Reset button.
'ExitBtnText':'Exit', // The text for Exit button.
'InvalidPriceText':'Error! Please enter a number for the price.' // The text for Invalid Price Warning.
},
It seems to me that I it could be something as simple as setting the DataURL and SaveURL to a controller/model ... but how would I connect the database, and how do I know what fields the table would have? Hopefully someone will have experience with this.
//This is the save query
if (isset($_POST['dop_booking_calendar'])){
require_once 'opendb.php';
mysql_query('UPDATE schedule SET data="'.$_POST['dop_booking_calendar'].'" WHERE id=1');
}
//this is the load query
require_once 'opendb.php';
$query = mysql_query('SELECT * FROM schedule WHERE id=1');
while ($result=mysql_fetch_array($query)){
echo $result['data'];
}