0

最初のクリック関数から「解析」関数に「appName」と「評価」を渡すにはどうすればよいですか? よろしくお願いします。使用しようとしましdata: {appName: appName, rating: rating}たが、それが機能した場合でも、「解析」関数でデータをキャッチする方法がわかりません

          <script>
            $(document).ready(function(){
              $('.one, .two, .three, .four, .five').click(function(){

                    //get the app name that's to be rated.
                    var appName = $(this).parents('*:eq(4)').text();
                    appName = appName.split("\n");
                    appName = appName[2]

                    //get the rating given to the app.
                    var rating = $(this).attr('class');

                    if(rating == 'one'){
                        rating = 1;
                    }
                    else if(rating == 'two'){
                        rating = 2;
                    }
                    else if(rating == 'three'){
                        rating = 3;
                    }
                    else if(rating == 'four'){
                        rating = 4;
                    }
                    else if(rating == 'five'){
                        rating = 5;
                    }


                $.ajax({
                    url: 'http://xxxxxx',    
                    dataType: 'xml',  
                    success: parse,
                    error: loadfail
                });

                });
            });
        </script>

        <script>
        function loadfail(){
          alert("Error: Failed to read file!");
        }

        function parse(document){

            $(document).find("ViewAll").find("ROW").each(function(){
                 var optionLabel = $(this).find('SC_DF_FIELD_1').text();
                 var optionValue = $(this).find('SC_DF_FIELD_4').text();
                 alert(optionLabel + ":" + optionValue);
            });
        }
        </script>
4

1 に答える 1