Сообщение JQuery AJAX для PHP

Хорошо, я построил свою json-строку, но я не уверен, что делать дальше ??

$('#submit').live('click',function(){ 

                var dataString = '[';
                    $('#items tr').not(':first').each(function(){
                        var index = $('#items tr').index(this);
                        var supp_short_code=$(this).closest('tr').find('.supp_short_code').text();
                        var project_ref=$(this).closest('tr').find('.project_ref').text();
                        var om_part_no=$(this).closest('tr').find('.om_part_no').text();
                        var description=$(this).closest('tr').find('.description').text();
                        var cost_of_items=$(this).closest('tr').find('.cost_of_items').text();
                        var cost_total=$(this).closest('tr').find('.cost_total').text();
                        dataString += '{"row":"' + index + '", "supp_short_code":"' + supp_short_code + '", "project_ref":"' + project_ref + '", "om_part_no":"' + om_part_no + '", "description":"' + description + '", "cost_of_items":"' + cost_of_items + '", "cost_total_td":"' + cost_total + '"}';
                    });
                    dataString += ']';

                $.ajax
                    ({
                    type: "POST",
                    url: "order.php",
                    data: dataString,
                    cache: false,
                    success: function()
                        {
                            alert("Order Submitted");
                        }
                    });
            });

В моем php-файле я пытался записать dataString в текстовый файл, чтобы я мог видеть, что он проходит. Хорошо, но ничего не было в текстовом файле !? Я делаю что-то не на стороне клиента или на стороне PHP, мой код php:

<?php
    $stringData = $_POST['dataString']; 
    $myFile = "testFile.txt";
    $fh = fopen($myFile, 'w') or die("can't open file");
    fwrite($fh, $stringData);
    fclose($fh);
?>
7
задан benhowdle89 5 November 2010 в 10:54
поделиться