select value to $.ajax type post
Hello,
Sorry, I looked for in this forum but I didn't find anything :(
I want to forward the result of my select (one choice) to my php file thanks to Jquery.ajax but
"$('#cdr_search_list').val" seems not to be a good method.
In fact, I have the following answer with Firedebug :
Array
(
[cdr_search_list] => Array
( [0] => test1 )
)
Code :
- $('#cdr_search_list').bind('change',
- function() {
- $.ajax({
- url: 'proxy_cdr_get_id.php',
- type: 'POST',
- data: {cdr_search_list:$('#cdr_search_list').val()},
- //data: {cdr_search_list:$('#cdr_search_list:selected').serialize()},
- dataType: 'json',
- cache: false,
- error: function(xhr, textStatus, errorThrown) {
- console.log(textStatus + " [" + errorThrown + "]");
- },
- success: function(result, textStatus, XMLHttpRequest) {
- $('#cdr_calldate').val(result[1]);
- $('#cdr_duration').val(result[2]);
- .....etc
- }
- <select id='cdr_search_list' multiple size="5" style="width:95%">
- <option value="test1">23 2012-10-02 10:44:56 130 130 0 0101010101 0172761699 caller 200 8 8 4280 4296 0 1 10 10 0 0 0 0 45 45</option>
- <option value="test2">23 2012-10-02 11:44:56 130 130 0 0101010101 0172761699 caller 200 8 8 4280 4296 0 1 10 10 0 0 0 0 45 45</option>
- </select>
Could you help me ?
Thank you