Thanks,
Will save this as it may come in handy.
I went with a different approach from Brian very similar to your and it
works
$(function() {
$('.Edit').each(function(){
var id_parts = $(this).attr('id').split('_');
$(this).editable('/notes/mynote/' + id_parts[id_parts.length
- 1] {
id : 'data[Notes][note]',
name : 'data[Notes][note]',
type : 'text',
cancel : 'Cancel',
submit : 'Save',
tooltip : 'Click to edit the title'
});
});
})
Thanks to all.
It may not get said enough to all those help out others with our questions
no matter how simple or advanced but THANK YOU!
Dave
-----Original Message-----
From: brian [mailto:[email protected]]
Sent: May-09-09 12:00 AM
To: [email protected]
Subject: Re: Pass variable to jQuery
Hey, I just remembered that DIV can take a title attribute. So, set it up
like:
<div class="edit" title="<?= $this->data['Post']['key'] ?>"> ...
</div>
$(function() {
$('.edit').each(function()
{
$(this).editable(
'/memos/mynote/'+$(this).attr('title'),
{
id : 'edit_data[Post][key]',
name : 'data[Memo][note]',
type : 'text',
cancel : 'Cancel',
submit : 'Save',
indicator : '<img
src="/app/webroot/css/images/spinner.gif">',
tooltip : 'Click to edit the title'
}
);
});
});
On Fri, May 8, 2009 at 8:59 PM, Dave Maharaj :: WidePixels.com
<[email protected]> wrote:
>
> I am using an inplace editor and need to add to the url in the js
> Where
> $(function() {
> $('.edit').editable('/memos/mynote/', {
> id : 'edit_data[Post][key]',
> name : 'data[Memo][note]',
> type : 'text',
> cancel : 'Cancel',
> submit : 'Save',
> indicator : '<img
> src="/app/webroot/css/images/spinner.gif">',
> tooltip : 'Click to edit the title'
> });
> });
>
> I need
> $('.edit').editable('/memos/mynote/65489', {
>
> Or another way to get the ID of the post to the mynote function?
>
> Thanks,
>
> Dave
>
> -----Original Message-----
> From: brian [mailto:[email protected]]
> Sent: May-08-09 6:13 PM
> To: [email protected]
> Subject: Re: Pass variable to jQuery
>
>
> I usually use rel for just this purpose when it's a link. However, a
> div cannot have a rel attribute.
>
> I'm sure there's still a better way to do this for this case.
>
> On Fri, May 8, 2009 at 4:28 PM, mbavio <[email protected]> wrote:
>>
>> Why not to create html attributes (like rel) that can be then
>> extracted by the dom parser that jQuery has? I read this techinque
>> somewhere, I cant remember where...
>>
>> On May 8, 10:16 am, brian <[email protected]> wrote:
>>> On Thu, May 7, 2009 at 2:45 PM, Dave Maharaj :: WidePixels.com
>>>
>>> <[email protected]> wrote:
>>>
>>> > Right thanks,
>>>
>>> > Going to test it out, try the first example first.
>>>
>>> > Where do I put the codeblock you have? MVC?
>>>
>>> In the view.
>> >
>>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---