|
 |
|
สอบถามเรื่อง jquery ajax success ครับ จากตัวอย่าง Codeข้างบน ผมอยากทราบว่า ถ้าจะให้แสดงผลสองส่วนจะต้องทำยังไงครับ |
|
 |
|
|
 |
 |
|
function getTypePrice()
{
var typePriceVale = $("#slc_type_price").val();
var dataString = "actCostID="+typePriceVale+"";
$.ajax({
type: "POST",
url:"/function/ajax_regist_normal_price",
data: dataString,
//data:"{userroleid:’”+myval+”‘}",
//contentType:"application/json; charset=utf-8" ,
dataType:"json" ,
success:function(response)
{
$("#txtbox1").text(response.data1);
$("#txtbox2").text(response.data2);
}
});
}
ไฟล์
/function/ajax_regist_normal_price หรือ /function/ajax_regist_normal_price/index.php ผมไม่แน่ใจ
ให้เขียนเป็น
<?php
$a = array(
'data1'=>'hello',
'data2'=>'good',
);
echo json_encode($a);
?>
|
 |
 |
 |
 |
Date :
2009-11-15 20:41:38 |
By :
num |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณ คุณ หนุ่มมากครับ
อิอิ
ท่านๆทั้งหลายที่ thaicreate ช่วยผมหลายครั้งแหละ
|
 |
 |
 |
 |
Date :
2009-11-15 20:51:57 |
By :
kingnaka |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ่อ
ที่คุณหนุ่ม พุดถึงนี้
function/ajax_regist_normal_price หรือ /function/ajax_regist_normal_price/index.php ผมไม่แน่ใจ
คือการให้ระบุนามสกุลไฟล์เลยใช่ป่ะครับ
หรือ /function/ajax_regist_normal_price.php
|
 |
 |
 |
 |
Date :
2009-11-15 22:00:23 |
By :
kingnaka |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
:) คือผมรู้สึกไม่คุ้นกับ url แบบไม่มี .php น่ะครับ
เลยสงสัยว่าเป็นการเรียกไฟล์ index.php หรือเปล่า
|
 |
 |
 |
 |
Date :
2009-11-15 22:16:38 |
By :
num |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ่อ แหะๆๆ ผมเป้นคนทำงานไม่ค่อยเป็นระเบียบน่ะครับ
ไงต้องหัดให้เป็นระเบียบมากกว่านี้
ขอบคุณมากครับ
|
 |
 |
 |
 |
Date :
2009-11-15 22:35:56 |
By :
kingnaka |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|