Danke für eure Hilfe ich habe das Problem damit lösen können.
Anfangs dachte ich die JQery Daten als json weiterverabeiten zu müssen was aber hier nicht der Fall ist. Ich will die Daten ja nur in der Datenbank speichern und nicht direkt wieder Ausgeben.
jQuery
Code
jQuery(document).ready(function ($) {
$('.dragme').draggable({
containment: '.medals-arrang',
stack: '.dragme',
stop : function(event, ui){
var x_Pos = parseInt($(this).css("left"));
var y_Pos = parseInt($(this).css("top"));
var need = ui.helper.data("need");
console.log(x_Pos);
console.log(y_Pos);
console.log(need);
$.ajax({
type: "POST",
url: "index.php?option=com_altauserpoints&task=arrangpos&format=raw",
cache: false,
data: {
varxpos : x_Pos,
varypos : y_Pos,
varneedid : need
},
})
}
});
});
Alles anzeigen
Models
Code
// übernimmt die Daten von draggable.js und Speichert sie in die Datebnaktabelle #__alpha_userpoints_medals
function _arrang_pos() {
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$rid = JFactory::getApplication()->input->get('rid', 0, 'int');
$msgType = '';
//Werte aus draggeble.js in DBTabelle
/*
img_leftPos (int)
img_topPos (int)
img_width (int)
arrang (int)
*/
$jinput = JFactory::getApplication()->input;
$arrangleft = $jinput->get("varxpos");
$arrangtop = $jinput->get('varypos');
$arrangid = $jinput->get('varneedid');
if ($arrangid) {
// update user medals
$query = "UPDATE #__alpha_userpoints_medals SET `img_leftPos`= $arrangleft, `img_topPos`= $arrangtop"
. "\n WHERE `id`=$arrangid";
$db->setQuery($query);
$db->query();
if (!$db->query()) {
$msg = $db->getErrorMsg();
$msgType = 'error';
} else $msg = $app->enqueueMessage('This part was successful');;
}
}
Alles anzeigen
Controller