calling function from dialog button jquery ui -


demo

calling function dialog box getting is not function error

button click dialog:

add: {     class: 'calendareventleft',     text: 'add',     click: function() {         var title = $("#title").val();         var description = $("#description").val();         var otherinfor = $("#otherinfo").val();         $(this).ajaxcall(title, description, otherinfor);     } } 

button showing dialog

$('#button').click(function() {      $("#dialog").dialog({         title: "qwe"     });     $("#dialog").html("<div>" + "<form>" + "title:<br>" + "<input type='text' id='title' class='calendarinput'>" + "<br>" + "description:<br>" + "<textarea id='description' class='calendarinput calendartxtarea'></textarea>" + "<br>" + "additional information:<br>" + "<textarea id='otherinfo' class='calendarinput calendartxtarea'></textarea>" + "</form>" + "</div>");     $("#dialog")         .dialog("open");   }) 

the function need run

function ajaxcall(title, description, otherinformation) {     consoole.log(title);     consoole.log(description);     consoole.log(otherinformation); } 

you calling $(this).ajaxcall(....) expecting ajaxcall plugin method, not why error.

just call like

ajaxcall(title, description, otherinfor); 

demo: fiddle


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -