Prevent ampersand from splitting up data string during ajax

Prevent ampersand from splitting up data string during ajax

Hi,
I'm using ajax to store values from a form into MySQL. The form
contains a text field named "title" and the method I'm using to fetch
and pass on the data to the backend is shown below:

_data =  "title=" + $( '#title' ).val();

$.ajax({
      async:     true,
        type:      "POST",
        url:      "backend.php",
        dataType:   "json",
        data:       _data,
      success:   function( json ) { .... }
      }
});


The method works fine for normal text, say "This is a sample text".

However, if an ampersand is used in the title text (example: "This &
That"
), the post value is being truncated at the ampersand. In effect, the & in it is causing the string to be split up into two segments and the
part after the & is being treated as a variable,

i.e. instead of passing

title = This & That


what is being passed is,

title = This
That =

* as shown by Firebug

Any suggestions on how to fix this?

Thanks,
m^e