How can I get my div id to reload via ajax and jquery
- by Matt Nathanson
I'm creating a CMS using jQuery and AJAX. When I click, my "Add Campaign" buttom, it creates a unique client ID in the DB and on a hard reload, the new client shows up in its container. I am trying to use ajax to reload the container on the fly and I'm not having the exact luck i am hoping for. I can get it to reload, but it's like it's pulling in descriptions of each of the clients as well!
function AddNewClient() {
dataToLoad = 'clientID=' + clientID + '&addClient=yes';
$.ajax({
type: 'post',
url: '/clients/controller.php',
datatype: 'html',
data: dataToLoad,
target: ('#clientssidebar'),
async: false,
success: function(html){
$('#clientssidebar').html(html);
},
error: function() {
alert('An error occured!');
}
});
};