StefanRSA Posted September 23, 2009 Share Posted September 23, 2009 I have a function: function deleteimage1(){ var image1Field = document.getElementById('image1'); upload_field.form.action = 'imagedelete.php'; upload_field.form.target = 'upload_iframe'; upload_field.form.submit(); upload_field.form.action = ''; upload_field.form.target = ''; return true; } I am trying to get the value of field with ID 'image1' and then post the value to the imagedelete.php file so I can delete an image without refresh. This is not working??? Can anybody please help me? Quote Link to comment Share on other sites More sharing options...
GKWelding Posted October 9, 2009 Share Posted October 9, 2009 to be honest I'd recommend using jQuery to achieve this! It would be as simple as: var filename = jQuery('#image1').val(); jQuery.post('imagedelete.php', { filename: filename }); You imagedelete.php file would need to be looking for $_POST['filename'], but this is easily changeable... Quote Link to comment Share on other sites More sharing options...
xenophobia Posted October 10, 2009 Share Posted October 10, 2009 I have a function: function deleteimage1(){ var image1Field = document.getElementById('image1'); upload_field.form.action = 'imagedelete.php'; upload_field.form.target = 'upload_iframe'; upload_field.form.submit(); upload_field.form.action = ''; upload_field.form.target = ''; return true; } I am trying to get the value of field with ID 'image1' and then post the value to the imagedelete.php file so I can delete an image without refresh. This is not working??? Can anybody please help me? I don't see any ajax transport used here... You are actually posting the whole form to imagedelete.php. 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.