Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //javascript
- function verificaCNPJ () {
- cnpj = $('#cnpj').val();
- $.ajax({
- type: "GET",
- url: "/verifica/cnpj/" + cpnj ,
- success: function (data) {
- console.log('Nao cadastrado');
- },
- error: function (data) {
- console.log('Cadastrado');
- }
- });
- }
- //routes
- Route::get('/verifica/cnpj/{cnpj}', 'Controller@verificaCNPJ');
- //controller
- public function verificaCNPJ($cnpj) {
- $parceiro = Parceiro::where('cpnj', $cpnj)->get();
- if(count($parceiro) > 0) {
- return response('Ja existe', 400);
- } else {
- return response('Sucesso', 200);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement