Click here to Skip to main content
15,891,708 members
Home / Discussions / Web Development
   

Web Development

 
Questionprinting on client's printer from web application running on server Pin
SKABBASJ2-Oct-12 0:27
SKABBASJ2-Oct-12 0:27 
AnswerRe: printing on client's printer from web application running on server Pin
SKABBASJ2-Oct-12 0:29
SKABBASJ2-Oct-12 0:29 
AnswerRe: printing on client's printer from web application running on server Pin
Pete O'Hanlon2-Oct-12 2:10
mvePete O'Hanlon2-Oct-12 2:10 
QuestionRTL Mobile website bad format on a Samsung Star mobile Pin
Ahmad Safwat30-Sep-12 3:25
Ahmad Safwat30-Sep-12 3:25 
QuestionSMS URL on htc mobile Invalid Recipient error Pin
Ahmad Safwat30-Sep-12 3:24
Ahmad Safwat30-Sep-12 3:24 
QuestionDialog auto-resize Pin
awedaonline27-Sep-12 8:25
awedaonline27-Sep-12 8:25 
AnswerRe: Dialog auto-resize Pin
Rockstar_7-Oct-12 21:01
professionalRockstar_7-Oct-12 21:01 
GeneralRe: Dialog auto-resize Pin
awedaonline12-Oct-12 1:12
awedaonline12-Oct-12 1:12 
QuestionMultilingual webpage Pin
Akash Patel25-Sep-12 6:27
Akash Patel25-Sep-12 6:27 
AnswerRe: Multilingual webpage Pin
Andrei Straut25-Sep-12 6:58
Andrei Straut25-Sep-12 6:58 
AnswerRe: Multilingual webpage Pin
Mighty Raju27-Sep-12 2:55
Mighty Raju27-Sep-12 2:55 
QuestionModifying accept header with IE9 and above Pin
Rajesh R Subramanian25-Sep-12 0:41
professionalRajesh R Subramanian25-Sep-12 0:41 
Questionvariable element id Pin
safa223-Sep-12 20:29
safa223-Sep-12 20:29 
AnswerRe: variable element id Pin
Andrei Straut24-Sep-12 20:25
Andrei Straut24-Sep-12 20:25 
Not taking into consideration the issues in your code (lack of prepared statements, hardcoded DB connection values, etc.) you should do the following. I also you suggest you use jQuery instead of plain JS, it makes working asynchronously much easier and shorter:

Taking the id of an element using jQuery is pretty easy and straightforward,
you use the bind() function:
JavaScript
$('#button_id').bind('click', function(event) {
    //Logic that triggers when the button is clicked
});

Then you submit your request to the server, also using jQuery:
JavaScript
$.ajax({
	type: 'GET' //GET or POST, depending on what you want to do
	url: 'the_link_to_your_script.php',
	data: {
            request_param1_name: request_param1_value,
            request_param2_name: request_param2_value,
	},
	success: function(data) {
            /*Your request was a success, you should have your data available in the 'data' variable*/
	},
	error: function(data) {
            /*Your request failed, treat it properly*/
	}
);

Further reading you can find for bind()[^] and ajax()[^]

I also suggest you take a look at PHP prepared statements[^]
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.

GeneralRe: variable element id Pin
safa226-Sep-12 4:35
safa226-Sep-12 4:35 
GeneralRe: variable element id Pin
Andrei Straut26-Sep-12 6:12
Andrei Straut26-Sep-12 6:12 
AnswerRe: variable element id Pin
Sebastiaan Meijerink30-Oct-12 4:08
professionalSebastiaan Meijerink30-Oct-12 4:08 
QuestionGet webcam capture Pin
Killzone DeathMan21-Sep-12 1:16
Killzone DeathMan21-Sep-12 1:16 
AnswerRe: Get webcam capture Pin
Joan M22-Sep-12 1:31
professionalJoan M22-Sep-12 1:31 
GeneralRe: Get webcam capture Pin
Killzone DeathMan22-Sep-12 11:10
Killzone DeathMan22-Sep-12 11:10 
QuestionHUGE Web Service Performance Issue Pin
Jammer21-Sep-12 0:53
Jammer21-Sep-12 0:53 
AnswerRe: HUGE Web Service Performance Issue Pin
jkirkerx21-Sep-12 11:04
professionaljkirkerx21-Sep-12 11:04 
GeneralRe: HUGE Web Service Performance Issue Pin
Mohibur Rashid22-Sep-12 3:00
professionalMohibur Rashid22-Sep-12 3:00 
GeneralRe: HUGE Web Service Performance Issue Pin
jkirkerx22-Sep-12 8:35
professionaljkirkerx22-Sep-12 8:35 
GeneralRe: HUGE Web Service Performance Issue Pin
manak chand22-Oct-12 0:24
manak chand22-Oct-12 0:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.