如何在jquery中传递php参数

From Here I am doing like I fetch data from database and display in table format still it is working fine, after I click the division_edit() function I want pass the value (id),how can do this.

<table id="dataTable" class="table table-bordered table-hover">
  <thead>
    <tr>
      <th>S.No</th>
      <th>Division</th>
      <th>Action</th>
    </tr>
  </thead>
  <tbody>
    <?php $sql=m ysql_query( "SELECT * FROM division WHERE status !='1'"); for($i=1;$row=m ysql_fetch_assoc($sql);$i++){ ?>
    <tr role="row" class="odd">
      <td>
        <?php echo $i;?>
      </td>
      <td>
        <?php echo $row[ 'division'];?>
      </td>
      <td><a class="btn btn-success btn-xs" href="state_edit.php?id=<?php echo base64_encode($row['id']);?>" onclick="division_edit()" id="division_edit"><i class="fa fa-pencil-square-o"></i> Edit</a> 
        <button class="btn btn-danger btn-xs" data-href="state_delete.php?id=<?php echo base64_encode($row['id']);?>"
        data-toggle="modal" data-target="#confirm-delete"><i class="fa fa-trash"></i> Delete</button>
      </td>
    </tr>
    <?php } ?>
  </tbody>

  <tfoot>
    <tr>
      <th>S.No</th>
      <th>Division</th>
      <th>Action</th>
    </tr>
  </tfoot>
</table>

</div>
doo58088
doo58088 onclick=“division_edit(<?phpechobase64_encode($row['id']);?>)”
3 年多之前 回复

2个回答

May this help you:

<table id="dataTable" class="table table-bordered table-hover">
  <thead>
    <tr>
      <th>S.No</th>
      <th>Division</th>
      <th>Action</th>
    </tr>
  </thead>
  <tbody>
    <?php $sql=m ysql_query( "SELECT * FROM division WHERE status !='1'"); for($i=1;$row=m ysql_fetch_assoc($sql);$i++){ ?>
    <tr role="row" class="odd">
      <td>
        <?php echo $i;?>
      </td>
      <td>
        <?php echo $row[ 'division'];?>
      </td>
      <td><a class="btn btn-success btn-xs" href="state_edit.php?id=<?php echo base64_encode($row['id']);?>" onclick="division_edit(<?php echo $row['id']; ?>)" id="division_edit"><i class="fa fa-pencil-square-o"></i> Edit</a> 
        <button class="btn btn-danger btn-xs" data-href="state_delete.php?id=<?php echo base64_encode($row['id']);?>"
        data-toggle="modal" data-target="#confirm-delete"><i class="fa fa-trash"></i> Delete</button>
      </td>
    </tr>
    <?php } ?>
  </tbody>

  <tfoot>
    <tr>
      <th>S.No</th>
      <th>Division</th>
      <th>Action</th>
    </tr>
  </tfoot>
</table>

Try this..

<a class="btn btn-success btn-xs" href="state_edit.php?id=<?php echo base64_encode($row['id']);?>" onclick="division_edit(<?php echo $row['id'] ?>)" id="division_edit"><i class="fa fa-pencil-square-o"></i> Edit</a> 
douan4106
douan4106 如何传递两个参数
3 年多之前 回复
dongwo1234
dongwo1234 谢谢,但是如何使用这个函数base64_encode()
3 年多之前 回复
doushi9444
doushi9444 哦,天哪! 你美化了我的答案。 谢谢你们
3 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问