Pagination plugin creation, .data trouble

Pagination plugin creation, .data trouble

Hello, 
I m doing my first plug-in with jQuery, I'm building a pagination one.
  • I want it to be used for more than one pagination on the same page (maybe not useful for a pagination, but I need to learn how to use a plug-in on several item in a page with different params for each items.)
  • I want to ad as a param the area to update, that's work, but I can't lets those data to be available at any time. I'm trying to link those with .data() on the pagination div. When I do the first click, it work, the second work to, but the data link is lost, so my .data() method return an error.
There is a lot of consol.log in the script to see what's happen.

Here is how to call the plug-in
  1. $('.pagination').pagination({
  2.     target: {
  3.         content: '#conso_table',
  4.         pagination: '.pagination'
  5.     },
  6.     script_file: 'con_gzn_edit_quantite.php'
  7. });
  • content: is the target area to update with the content
  • pagination is the target area to update with a new pagination data provided by the web server(php) trough an xml file
XML file
  1. <request>
  2.      <content> content to show (in html) </content>
  3.      <pagination> pagination content (in html) </pagination>
  4. </request>
In the xml as in the plug-in calling script, it's possible to add more than content and pagination area, by exemple, you have 2 areas to update with your content, just add a  key : value in target and add a  < tag> html content  in the xml, the plug-in will update areas by itself.
html
  1. <div class="pagination"> 1 2 ... </div>
  2. <div id="conso_table"> content to paginate </div>
  3. <div class="pagination"> 1 2 ... </div>
If somebody can help me, that will be greeat.

Regards,
twentyeight