Hi, didnt know where to post this as there is a mixture of languages/frameworks. This is related to JQuery mobile, but the question isnt really about that. I asked a similar question earlier, but this is a new approach.

Say I have some self contained blocks like so
Code:
$("#email-container").on("expand", function (evt) {
        var $this = $(this);
        $this.trigger("collapse");
        var $header = $this.find("#email-header-content");
        $header.html("");
        var $input = $("<input/>").appendTo($header);

        $input.on("click", function (evt) {
            evt.stopPropagation();
            return false;
        });

        $input.on("keyup", function (evt) {
            $this.data("input", $input.val());
        });
        $("#email-container").bind("change", function (event, ui) {
            $this.data("input", $input.val());
            var $headerContent = $("#email-header-content");
            var name = $this.data("input");
            if (name) {
                $headerContent.html(name);
            }
            else {
                $headerContent.html("Please choose...");
            }
        });
    });

    $("#email-container").on("collapse", function (evt, ui) {
        var $this = $(this);
        var $headerContent = $("#email-header-content");

        var name = $this.data("input");
        if (name) {
            $headerContent.html(name);
        }
        else {
            $headerContent.html("Please choose...");
        }
    });
In short, the above adds an input field to my header and sets the input to $this.data("input", $input.val()); When the user clicks off the field, what they inputted is set as the title of the header bar. In essence, the inputted data can be obtained through var name = $this.data("input");

I have several of these blocks, each getting different inputs. I now need to send this to my php script so it can be emailed. At the moment I am trying
Code:
$('#form2').submit(function () {
        var $this = $(this);
        $.ajax({
            type:'POST',
            url:'forms/requestProcessor.php',
            data:{ dateVal:$this.data("name") },
            success:function (response) {
            }
        });
    });
At the moment, the above doesnt work, and I assume its because var $this = $(this); doesnt relate to what I need it too. So how would I go about getting the data from the first blocks into the submit function?

Many thanks