Thursday, 15 August 2013

Update jqGrid text upon click

Update jqGrid text upon click

I'm trying to make this grid change whenever it is clicked. So, when I
click add, it changes to remove. Here's the code I've got so far, but the
logic I have is obviously bogus:
if($row->bid != 'Remove')
{
$bid = "<a href='#' onclick='addbid();'>Add</a>";
}
else
{
$bid = "<a href='#' onclick='removebid();'>Remove</a>";
}
Here are the javascript functions to go with them:
function addbid(id)
{
$.post("http://websiteowner.com/action.php/scheduleaddbid", { id: id },
function()
{
$("#grid").trigger("reloadGrid");
}
);
}
function removebid(id)
{
$.post("http://websiteowner.com/action.php/scheduleremovebid", {
id: id },
function()
{
$("#grid").trigger("reloadGrid");
}
);
}
I'm trying to do this all without refreshing the page, but I'm stuck on
this part.

No comments:

Post a Comment