Reputation: 41
I'm trying to send a value of a table cell to a jQuery POST script.
The $.ajax
part works when just hard coding the values. Guess I'm doing something wrong with assigning the "extension" variable in jQuery.
Below the jQuery script:
<script>
function myCall() {
$(".btn btn-warning btn-sm").click(function () {
var extension = $(this).closest("tr").find(".Extension").text();
}
$.ajax("/cura/pages/test.php/",{
type: "GET",
data:{
action:'pause',
pauselocation: $extension,
queue: 'testq',
paused: 'true'
}
});
request.done(function(msg) {
$("#mybox").html(msg);
});
request.fail(function(jqXHR, textStatus) {
alert( "Request failed: " + textStatus );
});
}
Any suggestions?
Upvotes: 1
Views: 2019
Reputation: 1803
Do this:
$(".btn btn-warning btn-sm").click(function () {
var extension = $(this).closest("tr").find(".Extension").text();
$.ajax("/cura/pages/test.php/",{
type: "GET",
data:{
action:'pause',
pauselocation: extension,
queue: 'testq',
paused: 'true'
});
});
Upvotes: 2