[技術討論] 請教jquery checkbox id

本帖最後由 carlkyo 於 2015-2-14 11:17 編輯

http://jsfiddle.net/e3nk137y/634/
請問各位CHING
個searchIDs要點寫啊
我依家GET到既係一堆錯ID
many thanks
["1", "6", "9", "10", "11", "12", "14", "15", "on", "on", "on", "on", "on", "on", "on", "on", "on", "on", "on"]

本帖最後由 hihihi123hk 於 2015-2-14 13:29 編輯
請問各位CHING
個searchIDs要點寫啊
我依家GET到既係一堆錯ID
many thanks
["1", "6", "9", "10", "11",  ...
carlkyo 發表於 2015-2-14 11:01



    http://jsfiddle.net/f92tbrLt/2/

睇錯左,原來要ID , 用checkbox bootstrap 會食左個original data 個ID , 唔洗加個field 落去
http://jsfiddle.net/f92tbrLt/5/

TOP

本帖最後由 carlkyo 於 2015-2-14 16:33 編輯
睇錯左,原來要ID , 用checkbox bootstrap 會食左個original data 個ID , 唔洗加個field 落去
...
hihihi123hk 發表於 2015-2-14 13:13




many thanks
不過我係local行會出
ReferenceError: data is not defined
return data[pos].id;

TOP

many thanks
不過我係local行會出
ReferenceError: data is not defined
return data.id; ...
carlkyo 發表於 2015-2-14 16:15

你個data 係咪錯scope?

一係開多行column

TOP

本帖最後由 carlkyo 於 2015-2-16 09:18 編輯
你個data 係咪錯scope?

一係開多行column
hihihi123hk 發表於 2015-2-14 21:15



    ching
http://jsfiddle.net/f92tbrLt/13/
var data因為呢個囧
我本身係用url sources
{
    "id": "1265",
    "created": "2015-02-03 15:03:50"
}
many thanks

TOP

咁樣寫好唔好呢
many thanks
  1. <?php
  2. $ar = array(
  3.     "title" => "JavaScript: The Definitive Guide",
  4.     "author" => "David Flanagan",
  5.     "edition" => 6
  6. );
  7. ?>
  8. <script type="text/javascript">
  9. var data = <?php echo json_encode($ar) ?>;
  10. </script>
複製代碼

TOP

咁樣寫好唔好呢
many thanks
carlkyo 發表於 2015-2-16 09:48

用php 出 javascript 既Data 呢個做法真係極醜惡

建議用 Ajax 拎

TOP

本帖最後由 carlkyo 於 2015-2-16 16:07 編輯
用php 出 javascript 既Data 呢個做法真係極醜惡

建議用 Ajax 拎
hihihi123hk 發表於 2015-2-16 10:04

hardcode var data落php度work

    可以教下我嗎.
定係可以直接defined php 個json object name
或用ajax get data嗎
many thanks
  1. //我個php
  2. $json = json_encode($array);
  3. echo $json;
  4. [
  5.     {
  6.         "id": "1265",
  7.         "operation": "delete",
  8.         "firstname": null,
  9.         "lastname": null,
  10.      }
  11. ]
複製代碼

  1. $.ajax({
  2. type: "POST",
  3. dataType: "json",
  4. url: "response.php",
  5. data: data,
  6. )};
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

  1. $.ajax({
  2. dataType: "json",
  3. url: url,
  4. data: data,
  5. success: success
  6. });
複製代碼
唔知咁得唔得

TOP

本帖最後由 carlkyo 於 2015-2-18 09:28 編輯
你個data 係咪錯scope?

一係開多行column
hihihi123hk 發表於 2015-2-14 21:15



ching
我用返url json file又得
但用php json file又唔得
請問要點改啊
many thanks
http://jsfiddle.net/e3nk137y/680/

TOP