Question: I am having some trouble posting data through AJAX. I created a small save script which determines in which table a POST must be saved (I am using a different form for each table):

```
$(function() 
{
    $( "#tabs" ).tabs().find( ".ui-tabs-nav" ).sortable({ axis: "x" });
});

function save(target)
{
    switch(target)
    {
        case "praktijk":
            $.ajax({                                                                                                           url: 'webscripts/admin/opslaan.php?type=praktijk',
                type: 'POST',
                data: $("#tabs-2").find('form').serialize(),
                success: function(){
                    alert("gegevens opgeslagen!");
                    $('#popup').dialog('close');
                }
            });
            break;
        case "persoonlijk":
            $.ajax({                                                                                   
                url: 'webscripts/admin/opslaan.php?type=persoonlijk',
                type: 'POST',
                data: $("#tabs-1").find('form').serialize(),
                success: function(){
                    alert("gegevens opgeslagen!");
                    $('#popup').dialog('close');
            }
        });
        break;
    case "vragen":
        $.ajax({
            url: 'webscripts/admin/opslaan.php?type=vragen',
            type: 'POST',
            data: $('#tabs-3').find('form').serialize(),
            success: function(){
                    alert("gegevens opgeslagen!");
                    $('#popup').dialog('close');
            }
        });
        break;
}

```

}

as you can see, I next determine it for the PHP script by using a GET variable that says which table it needs to save it in. But this doesn't work. The script appears to be crashing at this point. I am not sure where exactly it crashes.. the Firebug terminal doesn't show any obvious errors.

Does somebody know why it doesn't work?

Answer: 
Well the answer for that is is like this create a folder called input in the app/

and create a file with [any\_name]\_input.rb let say you name it image\_tag\_input.rb

then the code inside the image\_tag\_input.rb look like this

```
 class ImageTagInput <  SimpleForm::Inputs::Base
   ## Because image tage doesnot work if not included the below
   include ActionView::Helpers::AssetTagHelper
   def input
    ("#{@builder.text_field(attribute_name, input_html_options)}" + "#{image_tag()}).html_safe
   end
end

```

and then on the html side

do this

```
<%= f.input :username,:as => "image_tag %>

```

Here and another example mention in [wiki](https://github.com/plataformatec/simple_form/wiki/Custom-inputs-examples) of the **simple\_form\_for**

Hope this help
I would suggest looking at using `f.label` and `f.input_field` instead of `f.input` since it would allow you to place the components as you would like and adding your images where you want them. 

Check out the [Simple\_Form](https://github.com/plataformatec/simple_form) documentation for more information and examples.

Example:

```
<%= simple_form_for @user do |f| %>
  <%= f.label :username %>
  <%= f.input_field :username %>
  <img xxxx>
  <%= f.button :submit %>
<% end %>

```