I'm trying to update my data using an update button.
What I want to do is:
When I click my data it turns into an input field where I can modify the data and then when I click the update button the data should be updated.

I have the
update button(the yellow button in picture) ready and thedata input fieldis also ready where I usedjQueryfound on net.
I don't know much about Ajax and jQuery. Database field names I want to update are tname and time
I need Update Method in Controller, Update Method in Model and Codes in View
Onclick turns into Input field codes:
<script>
var switchToInput = function () {
var $input = $("<input>", {
val: $(this).text(),
type: "text"
});
$input.addClass("loadNum");
$(this).replaceWith($input);
$input.on("blur", switchToSpan);
$input.select();
};
var switchToSpan = function () {
var $span = $("<span>", {
text: $(this).val()
});
$span.addClass("loadNum");
$(this).replaceWith($span);
$span.on("click", switchToInput);
}
$(".loadNum").on("click", switchToInput);
</script>