OK, i have the following issue:
$favs is an array
$cart is an array
If user is logged in, i have $session_favs set, if no user is logged in i have $sesssion_cart set. ---> UP TO HERE IM FINE.
Now, im fetching Json Data in which i need the following:
- If isset($_SESSION['id']), check if [login to view URL] is in $favs array and if it is ->checkbox checked.
-if no Session Id logged in, check if [login to view URL] is in $cart array and if it is ->checkbox checked.
AND ALSO the checkboxes in json should be further submitable through Ajax.
HERE IS MY CODE SO FAR
var data = data;
var session_id = [login to view URL]( '<?php echo json_encode($session_id) ?>' );
var cart = [login to view URL]( '<?php echo json_encode($cart) ?>' );
var favs = [login to view URL]( '<?php echo json_encode($favs) ?>' );
var WinkForm = '';
if(session_id != null) {
WinkForm = "<form><td class='add_fav' rowspan='1' valign='top'><input type='checkbox' name='fav' id='"+b.id+"' value='"+b.id+"'if(in_array(+b.id+, favs))"checked><label for='"+b.id+"'><img src='images/[login to view URL]' height='100%' width='100%'></label></td></form>";
} else {
WinkForm = "<form><td class='add_star' rowspan='1' valign='top'><input type='checkbox' name='star' id='"+b.id+"' value='"+b.id+"'if (in_array("+b.id+", "+cart+")){ checked }><label for='"+b.id+"'><img src='images/[login to view URL]' height='100%' width='100%'>"+b.id+"</label></td></form>";
}
$.each(data, function(a , b) {
var tbl_row =
"<tr><td>"+cart+"</td><td>"+session_id+"</td></tr><tr valign='top'><td width='90' rowspan='3'><a href='[login to view URL]"+b.id+"&submit=submit'><img src='"+b.file+"' alt='image' width='100%'></a></td><td><a href='[login to view URL]"+b.id+"&submit=submit'><h3>"+b.title+"</h3></a></td><td align='right' width='100px'><eu>€ "+b.price+"</eu></td></tr><tr><td colspan='2'><h7>"+b.details+"</h7></td></tr><tr><td style='font-size:0.7em; color:#333;' valign='bottom' align='left' colspan='1'><span data-livestamp='"+b.date+"'></span> | "+b.city+" "+b.region+" "+b.pn+"</td>"+WinkForm+"</tr>";
Hello!
With 98% to 99% completion rate, 800+ successfully completed projects, and a 5.00 reputation (maximum possible, 5.0) (Yes, not even 4.99 average rating, can be verified on my profile page https://www.freelancer.com/u/rajeshsonisl.html !!)... you can never go wrong choosing me :)
I look forward to your reply.
Thanks.
Kind Regards,
Rajesh Soni