I am having a lot of trouble learning how to successfully use ajax. On the project that I am working on to learn this, I am selecting between a variety of people on a chart. When I select the person, I click their button and update the database. However, I need to be able to populate a modal in order to send a message to that person. I have been trying to use ajax to do this as all I need is the one $userid variable that is chosen.
My code is below, and if there is an easier way to do this without using ajax that would be great as well!
php
<?php if (isset($_POST['usrid'])) {
$whatineed = $_POST['usrid'];
?>
div modal stuff
<?php>
js
$(".selectLink").click(function(e){
e.preventDefault();
var _self = this;
$.post(
site_url("user/update"),
{
usrid: $(this).attr("usrid")
}, function(){
$('#Contact').modal({show:true, backdrop: 'static', keyboard: false});
}
)
return false;
});
Any help would be greatly appreciated!
populate a modal in order to send a message to that person. Code you run within ajax callback will only work on current page