How can I get my div id to reload via ajax and jquery

Posted by Matt Nathanson on Stack Overflow See other posts from Stack Overflow or by Matt Nathanson
Published on 2010-04-12T21:53:22Z Indexed on 2010/04/12 22:03 UTC
Read the original article Hit count: 224

Filed under:
|
|
|
|

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!');
 }
 });


};

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX