Ajax help [SOLVED]

Ajax help [SOLVED]

I am trying to retrieve some value from a php onsubmit. I am stuck. Can someone help please?

here is my code

$(function(){ $.ajax({
    $('#myForm').submit(function() {
   success: function(msg){
     $('td#myerror').html(msg);});
});


in the php I catch the error and I can echo it.

The best I got for it to display, but displays the error on page load is

$(function(){
$.ajax({
   type: "POST",
   url: "submit.php",
   data: "do=info",
      success:   function(msg){
     $('td#error').html(msg);} 
});
});