I'm trying to send a variable, intent, alongside the default variables of jeditable. According to the documentation, the default should send the variables id and value (I've confirmed that every element I'm using jeditable with has a valid id). I'm using the following code:
jedit-config.js
$(document).ready(function () {
$('.jedit').each(function() {
var $this = $(this);
$this.editable('service.php', {
loadtype : 'GET',
onblur : 'submit',
submitdata : { 'intent' : 1 }
});
});
});
service.php
$elID = $_GET['id'];
$newText = $_GET['value'];
$intent = $_GET['intent'];
if ($intent == 1) {
// Do something. Never called.
}
echo $newText;
Example of element that jeditable is used on:
<li id='listend' class='jedit'>Text here</li>
None of my variables (id, value or intent) reach service.php. They're all blank. I've sent variables to service.php using the following test and it receives it correctly:
$.ajax({
type: "GET",
url: "service.php",
data: "intent=1",
success: function(result){
//
}
});
Not sure what I'm doing wrong?
Update:
Looks like variables are being sent by POST and not GET. loadtype : 'GET' appears to only apply when used in conjunction with the loadurl option. I'm seeing if there's a method to use GET with the original url.
As per my update, it looks like there's no straightforward means to send data to a url from jeditable by
GET, onlyPOSTif not using aloardurloption.The answer is to switch to using
POSTor integrate a method that uses aloadurloption. Without this option,loadtype : 'GET'does not switch the data submission type toGET.