Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 Finally i did it . I just created 5 new functions and assigned to each button. Thank you all guys for trying to help me, thanks Ken2k7 for tips.Take care WOW! Um.. not what I had in mind, but if you don't mind having 5 functions for this one feature, then fine with me. Quote Link to comment Share on other sites More sharing options...
reactor86 Posted May 11, 2009 Author Share Posted May 11, 2009 Well i had no choice ,because of lack of time and knowledge of Java. I wish i could see what you have in your mind, i wonder your way too. Let me clear up what i intend to do. I have 5 buttons in my form.html where each executes a bat file without refreshing the page.When any button is pressed, request is sent to my phpform.php where php compares and recognizes which button was pressed and executes the respective bat file ,also sends a response to my html page. I hope now it's clear. By the way the reason i execute bat files is to send ascii characters to COM1. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 I already know what you wanted to do. And frankly, it's just a lack of programming and *common* knowledge, not JavaScript knowledge. I know a mix of both JavaScript and PHP but this issue really doesn't depend on you knowing those specific languages. Let's not forget this isn't really AJAX we're talking about. The AJAX has been done and it's working. We haven't done a single AJAX thing yet. Everything has just been JavaScript. Now, there's not much difference between JavaScript syntax and PHP, so I don't know why JavaScript would be so hard for you to understand. Perhaps, you're over-thinking. If you look at your get function, you see that no matter what button you press, you're always going to send those data. For example, if you click button4, you're still sending submit1 information from your JavaScript get function. So in your PHP script, the first if statement is *always* true. Why? Because you sent submit1 in your JavaScript poststr even if you didn't click the button. So I mean it's more like common sense more than it is JavaScript-specific. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.