开发者

data in mysql show after barcode split and matches character

i need some code for the next step..this my first step:

<script>
$("#mod").change(function() {
       var barcode;
       barCode=$("#mod").val();
           开发者_开发百科var data=barCode.split(" ");
           $("#mod").val(data[0]);
           $("#seri").val(data[1]);
       var str=data[0];
       var matches=str.matches(/EE|[EJU]).*(D)/i);
      });
</script>

after matches..i want the result can connect to data base then show data from table inside <div id="value">...how to do that?


you can start here. $.ajax();

You should have some server side scripting knowledge also.


You will need to do it using an ajax call (matches will be a parameter for the call). The php script called through ajax will have to fetch the data and give it back to the calling page. There you will need to parse the ajax response and display what you want.

A helpfull tutorial can be found here.


<script>
$("#mod").change(function() {
       var barcode;
       barCode=$("#mod").val();
           var data=barCode.split(" ");
           $("#mod").val(data[0]);
           $("#seri").val(data[1]);
       var str=data[0];
       var matches=str.matches(/EE|[EJU]).*(D)/i);

       $.ajax({
                    type:"post",
                    url:"process.php",
                    data:params,
                    cache :false,
                    async :false,
                    success : function() {
                                           alert("Data have been input");
                                           $("#value").html(matches);


                                            return this;
                                     },
                    error : function() {
                                            alert("Data failed to input.");
                                    }
            });
            return false;

      });
</script>

and i change my process.php become:

select itemdata as version from settingdata where version = "tunerrange";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜