javascript - On click submit a form the redirect to a URL is not working -


I have a list of items, for each item I have a button, clicking the button, I submit the form I am here.

Div style = "float: left; margin top: 4px," class = "enroll_onload" data-content = "local host / action / event_calendar / manageonal & event_id = 40117 & amp; group_guid = 40129 & Amp; user_id = 2 & amp; amp; amp; course_id = 12 "data-id =" 40117 "id =" enroll_btn "& gt; & Lt; A href = "javascript: zero (0)" category = "to enroll" & gt; & Lt; Span class = "enroll_button" & gt; Nominate & lt; / Span & gt; & Lt; / A & gt; & Lt; / Div & gt; & Lt; Form method = "post" action = "http://10.0.1.22/firstplanet/fpin/dev/learn/amfphp/services/data/rest/enrollCourseOnLoad" id = "enroll40117" & gt; & Lt; Input type = "hidden" value = "2" name = "user_id" & gt; & Lt; Input type = "hidden" value = "admin" name = "name" & gt; & Lt; Input type = "hidden" value = "any@gmail.com" name = "email" & gt; & Lt; Input type = "hidden" value = "admin" name = "user name" & gt; & Lt; Input type = "hidden" value = "any.png" name = "user image" & gt; & Lt; Input type = "hidden" value = "12" name = "course_id" & gt; & Lt; / Form & gt;

So in this way I have one more ten items with different values ​​& amp; ID . Form_id = $ (this) .next ('# enrollment' + id); live ('click', function) (var id = $ (this) .attr ('data-$' id '); above hrefTo = $ (This) .attr ('data-content'); $ (form_id) .submit (function () {wall (), 'email': $ ('input [name = email]'). Val () (' ('Input [name = user_id]'). Val (), 'username': $ ('input [name = user name]'). Val (), input '[name = email],' user_id ' 'UserImage': $ ('input [name = userImage]'). Val (), 'course_id': $ ('input [name = course_id]') Val ()} $ .ajax ({type: 'Post ', // define HTTP type action we (posted for our form) Want to use RL: '[url]? $ Vars echo php & lt'? & Gt; learn / amfphp / services / data / rest / enrollCourseOnLoad '', data: formData, success: function (data) {if (data } {Window.location.href = hrefTo;}}});});});

I am facing this problem when I do not submit the function, after that I can not debug a script when it is not known on the function, this means its code is executed to $ (form_id)

What's the problem?

$ ('div.enroll_onload').

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -