Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Re)Load @captcha directive in form via AJAX #102

Open
elijahpaul opened this issue Jan 8, 2019 · 0 comments
Open

(Re)Load @captcha directive in form via AJAX #102

elijahpaul opened this issue Jan 8, 2019 · 0 comments

Comments

@elijahpaul
Copy link

Any idea how I'd go about using this package in a form that is loaded/refreshed via AJAX?

I'm currently refreshing an existing form in place via jQuery .load()?

register.blade.php

......
<div id="content">
	<form method="POST" action="{{ secure_url('register') }}">
		@csrf
		<input id="name" type="text" name="name" required autofocus>
		<input id="email" type="email" name="email" required>
		<input id="password" type="password" name="password" required>
		<button id="submit-btn" type="submit" class="btn">
		@captcha()
	</form>
</div>
......

AJAX that reloads the above form

......
$.ajax({  
  data: {locale: lang_prefix},  
  type: 'GET',  
  url: '/locale/' + lang_prefix,  
  success: function (result) {        
  $('#content ').load(location.href + ' #content>*', '');
  }  
});
......

but the scripts in the rendered @captcha directive don't reload/execute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants