Jump to content

How to pass array from html to jquery ?


mlotfi

Recommended Posts

Hi,
 
I have server side data that populate a datatable, I stack when trying to pass array data from html page to jquery to fill the detail, as you can see in this fiddle, the detail is hard coded :
 
 
I am looking for a way to send an array to that format function.
 
Thanks, your help is appreciated.
 

 

Link to comment
Share on other sites

tr.find('td').first().data('agencies') will get your json encoded array out of the data attribute on the first TD element. So long as it's valid JSON jQuery will automatically decode it into an array so you can pass it to your format function.

 

// Open this row
var agencies = tr.find('td').first().data('agencies');
var html = format(agencies);
row.child(html).show();
tr.addClass('shown');
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.