AjaxForm not working in Safari and Chrome

ajax, ajaxform, jquery

Solution

you should use the ajaxSubmit function, the code to send a POST a request:

$("#imageform").ajaxSubmit({
    url: 'ServerSidePage.php',
    type: 'post',
    success: function() 
    { 
      alert("works!");
    }
});

EDIT: might check this out also:

$('#imageform').ajaxForm({
  success: function(response, statusText) {
    $('#preview').html(response);
  }
});

i don't know what "#preview" is, might change it to "append" or whatever you need.

Problem

This javascript works in FF but not safari or Chrome: ``` $('#image').change(function() { $('#imageform').ajaxForm({ target: '#preview', success: function() { alert('works!'); } }).submit(); }); ``` Here is the HTML form: ``` <form id="imageform" method="post" enctype="multipart/form-data" action="/admin/ajaxImage/"> ``` Please help me get it to work in Safari and Chrome! EDIT: I found my problem. I have a form inside a form, which prevents it from working. Thank you all for all of your suggestions.

Original source