I am creating a notification system that refreshes a php file executing a query to display the notifications., and am making use of jquery ui draggable by adding the .draggable class to divs with success, but whenever the draggable div is included this way, it doesnt know its a draggable. Any thoughts on why its not seeing itself as a draggable?
I tried adding the draggable script and references to nudgecheck (the included php file where draggable is broken) but no luck.
nudgecheck:
<div id='$nudgeid' class='draggable'>
// mysql query content
</div>
Code to refresh nudgecheck:
<div id="notifications">
</div
<script>
function showUser() {
var str = "<? echo $salesman;?>";
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("notifications").innerHTML = this.responseText;
}
else if (XMLHttpRequest.readyState == 0) {
// Network error (i.e. connection refused, access denied due to CORS, etc.)
}
else {
// something weird is happening
}
};
xmlhttp.open("GET","/nudgecheck/?q="+str,true);
xmlhttp.send();
}
setInterval(function () {
showUser();
}, 3000);
</script>
on the page that has #notifications div
$(function() {
$(".draggable").draggable({
revert: true,
helper: "clone",
cursorAt: { bottom: 0 },
revertDuration: 1000,
cursorAt: {
bottom: 0,
right: 0},
});