Jump to content
Fórum Script Brasil
  • 0

Ajuda ao passar um valor GET via ajax com o input radio


Lucca.
 Share

Question

Olá, se alguém pudesse me ajudar ficarei muito grato. Sou iniciante na área do JavaScript e Ajax e gostaria de passar um valor(value) por GET via ajax.

Vou postar o trecho do meu código correspondente:

index.php

<section class="carousel">
				 <input class="btn" type="radio" value="<?php echo $od_title['link_producao'] ?>" id="<?php echo $od_title['link_producao'] ?>" name="production-link">
				 <label id="production" onclick="toggleOverlay(); (function(){history.pushState(null, null, '../new-od/<?php echo $od_title['link_producao'] ?>')})()" class="button" for="<?php echo $od_title['link_producao'] ?>">
					 <div class="production">
						 <div class="cover">
							 <div class="mask">
								 <h5><?php echo $od_title['titleProd'] ?></h5>
								 <h6><?php echo $season ?> Temporada<?php if($season > 1) {echo"s";} ?></h6>
							 </div>
							 <img class="cover-img" src="https://megapro.com.br/productions-database/img-archive/<?php echo $od_title['small_logo'] ?>" alt="">
						 </div>
					 </div>
				 </label>
		</section>

.js

$(function(){
	$(".button").on("click", function(){
		
		var linkprev = $('input:radio[name=production-link]:checked').val();
		var linkProduction = console.log(linkprev);
		
		$.ajax ({
			type: 'GET',
			data: {
				linkp: linkProduction,
			},
			url: "session-megaod/session-producoes/homepage-new.php",
			success: function(result){
				$(".overlay-content").html(result);
			},
			error: function(){
				$(".overlay-content").html("Error");
			}
		});
	});
});

Se alguém puder me ajudar nessa jornadaaa... desde já, muito obrigado!

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...