Quantcast
Viewing all articles
Browse latest Browse all 8581

problem with bsp-ajax

hi to all

I'm new on bsp programming and  i have  problem.

 

 

i have a layout in html and i have autocomplete on firts cell

 

 

when run autocomplete ad i select 1 row i want to run another page html and i want to get file json  but  i don't get result.

 

 

my javascript code is:

 

 

         $("#MATNR).autocomplete({

                source: function( request, response )

                {

                  $.ajax(

                  {

                      url: "Test.htm",

                      dataType: "json",

                      data: {term: request.term},

                      success: function(data){

                                  response($.map(data, function(item){

                                    return{

                                      label: item.id + ' ' +  item.name  ,

                                        value: item.id };}));}

                                        });

                },

                minLength: 2,

                select: function(event, ui)

                {

 

$.ajax({

         type: 'POST',

         url: 'get_price.htm',

         data: {term: ui.item.value},

         contentType: "application/json; charset=utf-8",

         sync: true,

         dataType: 'json',

         success: function (jsonData) {

             alert("OK " + jsonData); // alert box1

             return jsonData;

         }

 

     });

                }

            });

 

 

 

 

 

 

code test.hml ( on request event)

 

 

concatenate '[' json_string into json_string.

 

wa_matnr-matnr = '00001'.

wa_matnr-maktx = 'NAME'.

 

concatenate json_string '{"id":"' wa_matnr-matnr '","name":"' wa_matnr-maktx  '"}' into json_string.

concatenate  json_string ']' into json_string.

 

 

call method _m_response->if_http_entity~set_cdata

   EXPORTING

     data = json_string.

 

 

When execute alert("OK " + jsonData)  result is OK [Object, object],

 

 

where i wrong ????   help me


Viewing all articles
Browse latest Browse all 8581

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>