jquery - Turning a Javascript Object Value into a Global Variable -


i have object fullcalender

events: [                  <?                  $sql =   "query removed";                   if ($result=mysqli_query($link,$sql))                 {                     // fetch 1 , 1 row                     while ($row=mysqli_fetch_assoc($result))                     {                      echo "  {                     title: '".$row['ename']."',                     backgroundcolor: 'green',                     start: '".$row['scheduleddate']."',                     eventid: '".$row['eid']."'                  }, " ;                      }                     // free result set                     mysqli_free_result($result);                 }                 ?>             ],             eventclick: function(event) {                      $('#modifydialog').dialog('open');                     $("#notes").val(event.eventid);                     var eid = event.eventid;             } 

i trying desperately make object (the event.eventid global variable can use here:

   var eid = ''; // handles click event link 1, sends query function getoutput() {     getrequest(         'checkdelete.php?sid=<?echo $sid;?>&eid='+eid, // url php file         drawoutput,  // handle successful request         drawerror    // handle error     ); 

basically, i'm trying take value, , pop ajax url statement - open suggestions if there better ways. thank advice.

i think can use:

 'checkdelete.php?sid=<?echo $sid;?>&eid='+$("#notes").val() 

that if value of element won't changed in meantime. can declare eid in global scope , use eid = event.eventid; set it.

var eid; events: [           ....         ],         eventclick: function(event) {                 .....                 eid = event.eventid;         } 

you can this:

window.eid = event.eventid; 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -