0

HTML CODE

 <form id="createCFrom">
    <table class="ui-widget">
        <tr>
            <td>Event
            </td>
            <td>
                <input type="text" id="CreateName" name="Event" />
            </td>
        </tr>
        <tr>
            <td>Date 
            </td>
            <td>
                <input type="text" id="CreateDate" name="Date" />
            </td>
        </tr>
        <tr>
            <td>Guest 
            </td>
            <td>
                <input type="text" id="CreateGuestName" name="Guest" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <button onclick="addCeremony();" class="right" id="saveCeremony">Save</button>
            </td>
        </tr>
    </table>
</form>

JS Code

function addCeremony() {
        alert($("#createCForm").serialize());
}
1
  • please include scripts within script tags! Commented Oct 15, 2012 at 5:49

3 Answers 3

6

Your id is createCFrom

<form id="createCFrom">

but your script refers to createCForm

function addCeremony() {
    alert($("#createCForm").serialize());
}
Sign up to request clarification or add additional context in comments.

Comments

2

hi have change <button> to <input> type and it is working please try this

 <input type='button' onclick="addCeremony();" class="right" id="saveCeremony" value='Save'>  

fiddle

1 Comment

Why does that help? The problem is the id of the form doesn't match the id used in the JS...
2

You have a typo:

alert($("#createCForm").serialize());

Should be:

alert($("#createCFrom").serialize());

(Or perhaps the id of the form is where the typo is - up to you to decide, but obviously what I'm saying is the id of the form has to match the id you use in your JS.)

Correct that problem and it works: http://jsfiddle.net/K5FVg/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.