JQuery :: Return Unique ID - .data(elem)

Feb 5, 2010

Before 1.4, it is possible to return an unique ID with jQuery.data(elem), now seems does not work.

[url]

The new api must need a key, what is the key then?

I just want an unique ID by inputing an element, why I need such a key?

View 4 Replies


ADVERTISEMENT

JQuery :: Form Data Not Displaying In Textarea On Subsequent Return Of Data From A Call?

Oct 5, 2011

Relatively new to jQuery but have a problem with getting data to display.Using a webform with 2 forms. User slects and inputs data into the first form, clicks a button then using jQuery .ajax submits the serialized data to a php script. The script processes the input into multiple paragraphs of text which is based on the input from the first form.The data is returned to the webpage and displayed in a text area (of the 2nd form) where the user can edit it to fine tune the wording. The 2 forms are displayed in different tabs so it is easy to move back and forward between the 2 forms.

The problem occurs when the user goes back to the first form and enters or selects different text and then click the submit button to generate a whole new text for insertion into the textarea on the second form. For certain fields the modified text is displayed.However if the whole of the text in the textarea is deleted, then the user clicks the submit button to re-generate the text content area then nothing at all is ever interted into the textarea. If have user alert to check that data is returned from the php handler and this text is correct. BUT when I click on the tab to see the textarea (id is "draftrec") there is no text inserted. The relevant function is below and the line that should insert the text into the textarea is:

$("textarea#draftrec").html(data).show();
//------------------------------------------------------
$("form#form1").submit(function(e){

[code]....

View 1 Replies View Related

JQuery :: Success - Error - Small Data Entry Screen - Post Form Data To A Page And Return A Message

Jul 22, 2011

I am writing a small data entry screen that will post the form data to a page and return a message. But i cannot get the Success or Error functions working properly.

Here's the code where strData is the posted querystring of:

I'm not sure whether it should be in a form and using the onsubmit or click of a button.

View 2 Replies View Related

Ajax :: Php Pull Unique Url From Database To Match Data On Screen

Jun 9, 2010

we have product pages; example page: [URL]

there is a selection of menus on the screen that you can change select different options to show you a price.

issue is as follows; i want to be able to create url's for every product in the database for google adword purposes; for example if they click on the google ad they come direct to the page/selection from the table/drop downs that is what they want. currently we have got as far as creating the below link;

[URL]

this link will take you to the product, but the drop downs from the menus haven't changed, just the price and the quantity.

i need to know of a way of selecting from the database and it be able to change the drop downs from a specific url.

our problem is we need to populate a select option in order of the one we send.

View 1 Replies View Related

JQuery :: SHOW An Elem With SlideUp()?

Oct 19, 2011

I would like to do the opposite of the norm: show an element by sliding it up, hiding it by sliding it down.. is this possible?

View 4 Replies View Related

JQuery :: Replace One Word In Elem.html() With Another

Aug 2, 2011

Can method replaceWith() be used to replace just ONE WORD in body of a tag (i.e., element.html()?) with another word? I have li's with "tab one", "tab two", "tab three" etc.. I have to replace dynamically ONLY the word "tab" with another word..

View 2 Replies View Related

AJAX :: Return Data From Php To Jquery?

Dec 21, 2010

I've got an ajax call that runs a password verification. The username/password work fine but I can't get the php to send data to to the AJAX, instead it just echoe's the result in an alert box code...

View 2 Replies View Related

JQuery :: Parse Post Return Data?

Jul 11, 2010

When I submit a post request in jquery i.e code...

How can I parse the returned data to get a specific element if the returned data is just an html page?

View 2 Replies View Related

JQuery :: Classic ASP And JSONP Output - Return Data

Jun 25, 2011

I found this post: [URL] It explains exactly what I want to do. The person who had the problem seemed to have sorted it out but as my knowledge is not to great I am not to sure what he is getting at. I tried various things but to no avail. All I want to do is return data to a calling javascript using type get and datatype jsonp. If I simply Response.Write "[(""id"": ""123""}]" then nothing happens. So whatever the thread I revered to above is doing it seems to be going in the right direction.

View 6 Replies View Related

JQuery :: Timezone - Get Data From System And Return In EU Format

May 21, 2010

I have my code php like that:
<?php
//Get the data from system and return in EU format
function ShowDate() {
$Date = date("d"."/"."m"."/"."Y");
return $Date;
}
//Get the time from system
function ShowTime() {
$Time = date("H".":"."i");
return $Time;
}
?>

Now I have two input box
<html>
<head>
</head>
<body>
Type the date:<input name="txtdate" type="text" class="input" id="txtdate" title="e.g dd/mm/yyyy" value="<?php echo ShowDate(); ?>" size="9" maxlength="10">
<br>
Type the time:<input name="txttime" type="text" id="txttime" value="<?php echo ShowTime(); ?>" size="5" maxlength="5">
<br>
London: Friday May 21 2010 05:12:00 <br>
New York: Friday May 21 2010 00:12:00<br>
Hong Kong: Friday May 21 2010 12:12:00<br>
Tokyo: Friday May 21 2010 13:12:00<br>
</body>
</html>

So.... the important is the user can interactive with the date. If I change the date or time all this values will be change as well. Someone knows how can I do this? The field txtdate I will get from a calendar plugin (javascript) that I already put in my code.

View 6 Replies View Related

JQuery :: Ajax Post - Accessing Return Data / Result Variable

Nov 30, 2010

So I'm currently working on a ASP.NET Webforms site and I've run in to a small problem. On my .cs file I have the following Webmethod

[WebMethod]
public static string IsJobEditable(int jobid){
try{
string isEditable = "false";
JobsBLL jbl = new JobsBLL();
int jobStatusId = jbl.GetJobStatusId(jobid);
//If the jobs is either waiting or being edited it is
okay to edit it
if(jobStatusId ==
Convert.ToInt32(ConstantsUtil.JobStatus.Waiting) || jobStatusId ==
Convert.ToInt32(ConstantsUtil.JobStatus.Edit)){
isEditable = "true";
}return isEditable;
}catch (Exception ex){
throw ex;
}}

This function in this case will ALWAYS return TRUE as a string. On Aspx page I have the following
$(function () {
$.ajax({
type: "POST",
url: "Coordination.aspx/IsJobEditable",
data: "{jobid:" + jobid + "}",
contentType: "application/json; charset=utf-8",
dataType: "text",
success: function (result) {
alert(result);

//This is written out in the alert {"d":"true"}
I want this in a variable as a string so I can do a check on it before I do some other actions. The format is not a String so I cannot split on it to retrieve the "true" part.
},
error: function (err, result) { alert(err); }
});});

As you can see in the comments the value I get back in the Callback method is in to me a weird format. The type is unknown and I need this value to be able to proceed with my entire method surrounding the small portion of the Javascript. Where to access the result variable / data as a var or anything else that will let me put it into a var (as a string).

View 1 Replies View Related

JQuery :: Regression: Form Plugin AjaxForm Cannot Access XML Return Data In Opera

Jan 26, 2011

I stumbled on this problem while testing StatusNet for our next release; we use jquery.form's .ajaxForm() to do various AJAX form submissions, including the primary message-sending form which includes a file upload control.

We've not seen problems before, but since upgrading from an old Form plugin version 2.17 to 2.49 a couple months ago, I've noticed our development branch no longer works properly in Opera: the actual submission goes fine, but we're unable to access the XML return data (which usually contains HTML fragments to put back into the UI).

I have a test case which demonstrates this at [URL] (source of the main page & submit handler are included there), using current jQuery 1.4.4 and jquery.form 2.52.

Under Firefox 4.0b10 and other browsers, the forms submit correctly, and we can read nodes and text out of the returned XML just fine.

But on Opera 11.00 and 10.63, the submission goes through but we get back an HTML document containing only "<head></head><body></body>". On Opera 9.63, it also includes the text "Blank page."

I tried to trace this down in jquery.form's history, and the trouble seems to have started around 2.39 with a commit ironically titled "iframe load fix (mostly for Opera)", which changes the event handling for forms submitted via iframe: from that version on, a 'load' event handler is added directly as an onload attribute on the iframe's source, whereas previously it was added with attachEvent or addEventListener.

It looks to me like the iframe is throwing a load event for the "about:blank" page, instead of for the submission.

I can revert back to 2.17 or another working version for now, but I'd like to make sure this is fixed upstream;

View 4 Replies View Related

JQuery :: Function Return - Pull Live Data From Database And Display It In An Alert Box On Sight

Oct 10, 2010

I'm very new to jQuery, only picked it up yesterday, so there is very little I understand at the moment. I have a website on which I would like to display a real time, time-series chart displaying results from a database that is constantly updated. how to pull live data from my database and display it in an alert box on my sight. One of the replies said I should use jquery to achieve this.

[Code]...

View 1 Replies View Related

Elem.style.top Not Working

Oct 1, 2009

I want to take the current location of an position:absolute div and add 100 to its style.top value. However I can't get that value, I can set it but not retrieve its current value. Here is a sample.... Code: function moveit(elem){ alert(elem.style.top); alert(document.getElementById("question1").style.top); } Demo: [URL]

View 2 Replies View Related

Return Data To The Server On The Fly

Jan 4, 2006

Read the first reply below first/instead, it's probably more helpful than this one

There's a lot of talk about AJAX these days and it seems to me it's turning into a hammer for a lot of problems that aren't really nails. If you want your pages to call home but don't want to have to deal with XML parsing and extremely spotty browser support, here's a very simple way to effect communication from Javascript to the server. The server can only (easily) communicate back on the next page hit with this method, but as a one way conduit from client to server post page rendering it can hardly be beat.

I've set it up with a really simple case that keeps track of the total time each user spends looking at a page in ten second increments. I have, for clarity (I hope) stuck it all in one PHP file, but it'll work the same with any server side language:


<?php
// this block isn't really too well coded or useful, it's intended more as a simple proof of concept
if (isset($_GET['ip']) && ip2long($_GET['ip']) !== false)
{
// if there's a GET variable (this.php?ip=something) and it appears to be a valid ip...
$fname = sha1($_GET['ip']) . '.time'
if (file_exists($fname) && strpos(($pre = file_get_contents($fname)), '='))
{
// if we have a file and it looks like it might be in the right format, increment the value contained therein
list($ip, $time) = explode('=', $pre);
file_put_contents($fname, $ip . '=' . ($time + 10));
}
else
{
// else just write it in and hope for the best
file_put_contents($fname, $_GET['ip'] . '=10');
}
/*
//actually returning an image here can help get the loading message out of browser's status bars

header('Content-type: image/gif');
fpassthru('small.gif');
*/
}
else
{
?>
<html>
<body onload="javascript:setTimeout('serverTick();', 10000);">
<script language="javascript">
var ip = '<?php echo $_SERVER['REMOTE_ADDR']; ?>' // give the javascript an ip or a hash or something to pass back that will be reasonably unique

function serverTick()
{
setTimeout('serverTick();', 10000); // call this function again in 10 seconds
var notshown = new Image();
notshown.src = '<?php echo $_SERVER['PHP_SELF']; ?>?ip=' + ip; // calls this file in attempt to preload an image, instead triggering the above block of PHP
}
</script>
</body>
</html>
<?php
}
?>


This will work in far more browsers than AJAX will, and it's not subject to any domain restriction, it can post to another server without generating security exceptions. It may be possible to get data back in the body of the image and it's definitely possible to get data back coded as image dimensions, if you want to push this method a little further.

View 5 Replies View Related

JQuery :: $('#mydiv').css('margin-left') Return 0px (must Return Auto)

Jun 3, 2010

All is on the title, sorry for my english, i'm french :) I have an html page with style

<style>
#mydiv {
margin-left:auto;
margin-right:auto;
width:250px;
}
</style>

with jquery, i try to get the margin-left ($('#mydiv').css('margin-left'), but the function return 0px, unable to retrieve the good value (auto) anyone has idea to retrieve the value "auto" when margin-left is "auto" ?

View 1 Replies View Related

JQuery :: DatePicker - How To Use Non Unique ID

Oct 12, 2011

I have been trying to figure this out for a while, and I cant manage to get it working. I have a table for instance the one below:
<tr>
<td><input type='text' id='test_value[]' .... /></td>
<td><input type='text' id='test_value2[]' .... /></td>
<td><input type='text' id='date[]' onclick ="testfunc(this);" .... /></td>
</tr>

Within my function I can grab the index of the onclick no problem, but when I select the date from the date picker, it always select the first column.
testfunc(val)
val.parentNode.parentNode.rowIndex
I am using clone to create multiple instances of a row, but how can I use non-unique id (date[]) which all my X rows have the same name, to unique enter the datepicker value.

View 3 Replies View Related

JQuery :: Loop Through <ul><li> Using Unique ID?

Apr 28, 2009

I am trying to loop through my top level nav i.e <ul> <li> and then apply that class name to teh sub level menu of that particular top level. So essentially the clas name on the top <li> wil be applied to its sub level items. Here is my code, which isn't working at the moment:

$(document).ready(function(){
var pageID = $('body').attr('id');
var uniquePageID
uniquePageID =$("#site-nav ul li",this).attr('id');

[Code].....

View 3 Replies View Related

JQuery :: Getting Unique Values In List?

Oct 31, 2011

I am using MVC3 with razor and binding dropdownlist with a listNow issue is @Html.DropDownListFor(model => model.Result, new SelectList(Model.Result.OrderBy(item => item.Enhet), "EnhetID", "Enhet"), "ALL")in Enhet i am getting 3 values Nitin NA NAI want to make sure that values are always unique, how can i remove duplicate values.

View 1 Replies View Related

JQuery :: Get All Unique Class Names?

Jun 11, 2009

I'm interested in getting an array of unique class names of all option tags under a specific select element. I'm imagining something like this (which does not do what I want): $ ( '#select_id option.class' ); What's the correct way to do this using jQuery?

View 3 Replies View Related

JQuery :: Passing Unique URL To Load()?

Jan 13, 2012

I'm just learning jquery an have an issue. I have a page, product.php, that is set up with unique urls depending on the product clicked. So, product.php?id=15, but in my PHP code, because I'm pulling from my database, it appears as product.php?id=$id. I am trying to get jquery to load that page, but with the unique id.

[Code]...

View 12 Replies View Related

JQuery :: Select Two Unique Elements By ID

Jan 30, 2010

Let's say you have two elements, and you know their IDs; is there a way to select them both at the same time; something like $('#test #test2')?I realize I could just select them both on two different lines and apply the same function, or use class or something to track them down; but sometimes I just want to grab two elements by ID and do the same thing to them. I assume I'm just missing the syntax.

View 1 Replies View Related

JQuery :: Unique Value In Find And Replace

Dec 7, 2011

My problem is that im using jQuery to replace the bb tags in a message. I want to replace all the [youtube][/youtube] with a youtube video and so far it works only if there is only 1 [youtube][/youtube] tag. If there is multiple [youtube][/youtube] tags in a message they change all of them to the same video.[code]

View 2 Replies View Related

JQuery :: Allow Assignment Of Unique IDs To Cluetip Container

Apr 15, 2011

I see that the cluetip plugin project is on github so, perhaps at some point I'll be able to try implementing this feature myself, and submit a pull request. My team is using the cluetip plugin in a rather exceptional way. Rather than a tooltip like msg bubble that appears on mouseover, we show the cluetip on page load and require the user to dismiss it. We're using these cluetips to communicate new features on our site. After looking at available jquery plugins, cluetip seemed to be best suited for this use (all be it, a rather exceptional use).

The current design allows for this use with just a bit of css work but it limits us to one cluetip visible on a page at a time. Multiple cluetips are not possible because the cluetip div container has a non-unique id and the jquery id selector is used in the plugin code (which means that only the first cluetip in the DOM is ever referenced by the code). I'd like to extend the code to allow for dynamic assignment of the id on the cluetip container which would allow us to render multiple cluetips on the page. Perhaps, this might constitute a new plugin, since this isn't really the intended use of cluetips.

View 1 Replies View Related

JQuery :: Hiding One Non-unique Element After Showing It?

Sep 16, 2010

$(document).ready(function()
{
$(".postTags_opener").click(function()
{
$(this).next(".postTitle .postTags").fadeIn(1000, function()

[Code]....

The indentation is probably a little wacky, since I just copy/pasted, but that's what I've got right now. When you click on .postTags_opener, it shows the nearest matched .postTags; that is exactly what I want, since .postTags immediately follows a .postTags_opener. The problem arises when I then try to close it: .postTags_closer comes after .postTags starts, so that's probably why next() is bugging out.

View 2 Replies View Related

JQuery :: Select .parent() - DIV Names Cannot Be Unique

Mar 23, 2011

Suppose I have something similar to this HTML (this is not my exact HTML, rewritten to simplify):

<a onclick="ShowHide(); return false;" href="#">show/hide</a>
<div>
<div id="summary">Summary of info below</div>
<div id="enclosure" style="display:none;">Information</div>
</div>
<a onclick="ShowHide(); return false;" href="#">show/hide</a>
<div>
[Code]...

These DIVS are full of information populated from a MSQL db. So the DIV names cannot be unique. I have this jQuery code:

[Code]....

This code actually works perfectly except for one major headache. When I click the 'hide/show' link on any of these - the only one that hides or shows is the first set. After research I feel like I'll need to use the .parent() selector or (this) somewhere but I feel like I've tried every combination.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved