Jump to content

My function is not working, what am I doing wrong?


StefanRSA

Recommended Posts

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?

  • 3 weeks later...

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...

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.