2010-06-11 52 views
0

後的數據我有這樣的代碼:的jQuery:顯示更改事件

<script> 
$("#mod").change(function() { 
var matches=str.match(/(EE|[EJU]).*(D)/i); 
     $.ajax({ 
        type="post", 
        url="process.php", 
        data="matches", 
        cache=false, 
        async=false, 
        success= function(res){ 
         $('#rslt').replaceWith("<div id='value'><h6>Tuner range is" + res + " .</h6></div>"); 
         return this; 
       } 
     }); 
    return false; 
}); 
</script> 

我想這個代碼可以顯示結果normally..where是我的錯?

回答

2

刪除return小號

和格式(的:代替=

  $.ajax({ 
        type:"post", 
        url:"process.php", 
        data:"matches=" + matches, 
        cache:false, 
        async:false, 
        success: function(res){ 
         $('#rslt').replaceWith("<div id='value'><h6>Tuner range is" + res + " .</h6></div>"); 
         // return this; <<--- remove that too... 
       } 
     }) 

,如果你想matches要傳遞的數據使用data:"matches=" + matches, ...

$_POST['matches']被通過PHP獲得價值的方式

+1

+1 - 很高興你明白OP的意思,大聲笑 – 2010-06-11 04:45:55

+0

非常感謝Reigel .. – klox 2010-06-11 04:52:20

+0

我希望人們先閱讀文檔。什麼是術語.... RTFM(閱讀Fuc * ing手冊)? lolz ... – 2010-06-11 07:06:22

0
<script> 
$("#mod").change(function() { 
var matches=str.match(/(EE|[EJU]).*(D)/i); 
     $.ajax({ 
        type:"post", 
        url:"process.php", 
        data:"matches="+matches, 
        cache:false, 
        async:false, 
        success: function(res){ 
         $('#rslt').replaceWith("<div id='value'><h6>Tuner range is" + res + " .</h6></div>"); 

        } 
     }); 
    }); 
</script>