How to store and pass paremeters with jQuery, Json and MVC

It's easy to store youre paremeters in the rel tab, like this

<a href="#" class="CreateCMS" rel="@klantenid"><h1>Bestel uw nieuwe CMS</h1></a>

In the click event of this tag you can than read the value back:

var id = $(this).attr('rel');

Sometimes its neccary to store multiple parameters, then it's possible to store it in Json format:

<a href="#" rel='{ "profileid":@item.GoogleAnalyticsId, "klantid":@item.KlantId }' class="ShowAnalyticsDirect">Google Analytics</a>

If you retrieve this value it has to parsed back to Json after that you can use and reach the property's

                var data = $(this).attr('rel');
                var object = $.parseJSON(data);
                var profileid = object.profileid;
                var klantid = object.klantid;




Saving your comment....

Naam is verplicht!
Email is verplicht!
Opmerking is verplicht!