2012-06-16 7 views
5

Jqueryを使用してfullCalendarに新しいイベントを追加する際に問題があります。私はEclipseを使用してWebを開発しています.Ajaxにはあまり精通していません.AperaはEclipseにはうまくいきません。Jqueryを使用してFullcalendarにイベントを動的に挿入

すべてがjqueryのbutton.click関数内に書かれています。

var subject = $("#txtEventName").val(); //the title of the event   
var dateStart = $("#txtDate").val();  //the day the event takes place 
var dateEnd = $("#txtDateEnd").val(); //the day the event finishes 
var allDay = $("#alldayCheckbox").val(); //true: event all day, False:event from time to time   

var events=new Array();  
event = new Object();  
event.title = subject; 
event.start = dateStart; // its a date string 
event.end = dateEnd;  // its a date string. 
event.color = "blue"; 
event.allDay = false; 

events.push(event); 
$('#calendar').fullCalendar('addEventSource',events); 

イベントは検出されませんでしたが、イベントは作成されません。 P.S:jQueryに他の方法がない場合は、配列フィードを使いたいと思います。あなたはstartに値を割り当てるときに、それはサポートされている形式のいずれかであることが必要であることを

var newEvent = new Object(); 

newEvent.title = "some text"; 
newEvent.start = new Date(); 
newEvent.allDay = false; 
$('#calendar').fullCalendar('renderEvent', newEvent); 

注:

+0

"event"はJavascriptの予約語なので、コード内の "event"オブジェクト名を変更すると動作する可能性があります。 –

+0

@Furqan私はそれをしました、まだ動作しません:( –

+0

あなたのHTMLにはどの.jsファイルが含まれていますか? – ganeshk

答えて

11

はこれを試してみてください。

ISO8601形式の文字列(例: "2009-11-05T13:15:30Z")をIETF形式(例: "Wed、18 Oct 2009 13:00:00 EST")で指定できますまたはUNIXのタイムスタンプ。