html - find and replace parameter value within an array in div in jquery -
i have div want replace value of parameter within array.
my php code generate html following
<div id="data1<?php echo $data['id']; ?>" data-url="<?php echo 'post/comment', array('post_id' => $data['id'], 'comment_id' => $data['c_id'])); ?>"></div>
when page rendered data-url contains
/blog/index.php/post/updatecomment?post_id=16&comment_id=''
i want put value in comment_id
, comment_id=12
i tried first see if can data-url value
but when
$('#data1).map(function(){ alert(this.data-url); });
it returns nan
$('#data1).map(function(){ alert(this.id); });
return id expected
i'd know if there way search & replace comment_id=''
comment_id=12
any appreciate
do this:
alert($(this).attr('data-url'));
Comments
Post a Comment