0

I have this jQuery script :

$('a.manage-content-link').click(function (e) {
var self = $(this),
    file = self.siblings('input[type="hidden.block-hidden-input"]').val();
var username = $("username").val();
var ids = $(this).attr('id'); 
self.next(".manage-content-wrap").find(".manage-content").load("test1.php?id="+ids+"&file="+file);
e.preventDefault();
});

and this HTML tags :

<li><input type="hidden" value="001" class="block-hidden-input" />
    <a href="#" id="manage-1" class="manage-content-link">
        <img src="images/web-block/web-block1.jpg"/>
        <span class="orange-notice">Click to Edit Content</span>    
    </a>
</li>

in the test1.php, I have this :

<?php
$file = $_GET['file'];
$id = $_GET['id'];

echo $file ."<br>";
echo $id ."<br>";
echo "Hello World";
?>

and here's what I got as an output :

undefined >> should be 001
manage-1
Hello World

why that script failed to get the Input Value (in this case : 001), but it successfully get 'ids' from a href' ID?

0

3 Answers 3

4

Your selector got messed up a little:

self.siblings('input[type="hidden.block-hidden-input"]').val();
                               ^^^^^

Try this one instead:

self.siblings('input[type="hidden"].block-hidden-input').val();

Also, are you sure you have a <username> element?

var username = $("username").val();
Sign up to request clarification or add additional context in comments.

1 Comment

@gdoron: Thanks, I missed that one.
2

This line is wrong,

file = self.siblings('input[type="hidden.block-hidden-input"]').val();

It should be

file = self.siblings('input[type="hidden"].block-hidden-input').val();

Comments

0

Should be

file = self.siblings('input[type="hidden"].block-hidden-input').val();

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.