Search Results

Search found 19 results on 1 pages for 'russp'.

Page 1/1 | 1 

  • Dynamically load Jquery into .js page

    - by RussP
    Please excuse me if I'm simple here, I want to create a simple widget that people can access from their websites - e.g by copy/past something like <script language="javascript" src="test2.js"></script> <div id="test"></div> anywhere in their web pages. where is dynamically filled via Jquery and the functions in/on test2.js. I can do it if JQuery is actually "printed" on the page of test2.js, but I cannot get any JQuery functions to work if I try to include/call JQuery dynamically. How do you call JQuery via javascript and then get it to work with the functions on the page? And/Or is there an easy way to add the <div id="test"></div> dynamically aswell? Sure I can body.append etc. but that only adds at the bottom of the page. Is there a way to .append in the position where the script include <script language="javascript" src="test2.js"></script> is actually placed? Hope I make sence.

    Read the article

  • jquery - array problem help pls.

    - by russp
    Sorry folks, I really need help with posting an array problem. I would imaging it's quite simple, but beyond me. I have this JQuery function (using sortables) $(function() { $("#col1, #col2, #col3, #col4").sortable({ connectWith: '.column', items: '.portlet:not(.ui-state-disabled)', stop : function () { serial_1 = $('#col1').sortable('serialize'); serial_2 = $('#col2').sortable('serialize'); serial_3 = $('#col3').sortable('serialize'); serial_4 = $('#col4').sortable('serialize'); } }); }); Now I can post it to a database like this, and I can loop this ajax through all 4 "serials" $.ajax({ url: "test.php", type: "post", data: serial_1, error: function(){ alert(testit); } }); But that is not what I want to do as it creates 4 rows in the DB table. I want/need to create a single "nested array" from the 4 serials so that it enters the DB as 1 (one) row. My "base" database data looks like this: a:4:{s:4:"col1";a:3:{i:1;s:6:"forums";i:2;s:4:"chat";i:3;s:5:"blogs";}s:4:"col2";a:2:{i:1;s:5:"pages";i:2;s:7:"members";}s:4:"col3";a:2:{i:1;s:9:"galleries";i:2;s:4:"shop";}s:4:"col4";a:1:{i:1;s:4:"news";}} Therefore the JQuery array should "replicate" and create it (obviously will change on sorting) Help please thanks in advance

    Read the article

  • ul sortables get serialized data

    - by russp
    Hi folks Any ideas how to get the serilized data from this function? the html is first with the JQuery function last, I cannot get the serialization to appear in the alert. When I can do that I can finish this by sending via ajax etc... <div class="column" id="col1"> <div class="portlet"> <div class="portlet-header">Feeds</div> <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> </div> <div class="portlet"> <div class="portlet-header">News</div> <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> </div> Shopping Lorem ipsum dolor sit amet, consectetuer adipiscing elit Links Lorem ipsum dolor sit amet, consectetuer adipiscing elit Images Lorem ipsum dolor sit amet, consectetuer adipiscing elit $(function() { $("#col1, #col2, #col3").sortable({ connectWith: '.column', receive : function () { serial = $('#col1').sortable('serialize'); //serial2 = $('#col2').sortable('serialize'); //serial3 = $('#col3').sortable('serialize'); alert(serial); } }); });

    Read the article

  • JQuery make an array - how/what is best

    - by russp
    I have 4 serailized arrays that I want to pass to php for processing. What is the best way to combine them into a single array example: serial_1 = $('#col1').sortable('serialize'); serial_2 = $('#col2').sortable('serialize'); serial_3 = $('#col3').sortable('serialize'); serial_4 = $('#col4').sortable('serialize');` each serialized array relates to a column/section of the page (col1,col2 etc.) What I need to do/would like to do is create a single array that puts the serialized array inside another array for a single post. example: var new_array = serilaize(col_1(serial_1),col2(serial_2),col3,(serial_3),col4(serial_4)) I KNOW THAT IS NOT RIGHT as I have no idea in JQuery how to right the correct syntax. This new array is to be posted via ajax like this: $.ajax({ url: "test.php", type: "post", data: new_array, error: function(){ alert('SOME ERROR MESSAGE'); } }); Thanks in advance

    Read the article

  • JQuery drag, drop and save via cookie - how to?

    - by RussP
    Sorry to be back folks, but you guys & girls seem to know much more about this than I do ... anyhow, here is my question/problem I want to use drag, drop, sort (the interface plugin does me even though I have read it's out of date? but have looked at UI and to be honest is not clear and to me appears heavier than interface?) Anyhow, how do I set a cookie to save positions from this: $(document).ready( function () { $('a.closeEl').bind('click', toggleContent); $('div.groupWrapper').Sortable( { accept: 'groupItem', helperclass: 'sortHelper', activeclass : 'sortableactive', hoverclass : 'sortablehover', handle: 'div.itemHeader', tolerance: 'pointer', onChange : function(ser) { }, onStart : function() { $.iAutoscroller.start(this, document.getElementsByTagName('body')); }, onStop : function() { $.iAutoscroller.stop(); } } ); } ); var toggleContent = function(e) { var targetContent = $('div.itemContent', this.parentNode.parentNode); if (targetContent.css('display') == 'none') { targetContent.slideDown(300); $(this).html('[-]'); } else { targetContent.slideUp(300); $(this).html('[+]'); } return false; }; var ser = function (s) { serial = $.SortSerialize(s); alert(serial.hash); }; which is the "standard" interface demo, PLUS How do I then get to read that cookie so that when I next visit the page the order is as I set it in the cookie? Hopefully from that I can work out the rest .......? Thanks for help in advance.

    Read the article

  • JQuery validate e-mail address regex

    - by RussP
    Hi folks, not too sure about how to do this. I need/want to validate email addresses by regex using something like this: [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum) Not I need to run this in a JQ function like this: Where does the validation go and wht is the expression? - please $j("#fld_emailaddress").live('change',function() { var emailaddress = $j("#fld_emailaddress").val(); // validation here? if(emailaddress){} // end validation $j.ajax({ type: "POST", url: "../ff-admin/ff-register/ff-user-check.php", data: "fld_emailaddress="+ emailaddress, success: function(msg) { if(msg == 'OK') { $j("#fld_username").attr('disabled',false); $j("#fld_password").attr('disabled',false); $j("#cmd_register_submit").attr('disabled',false); $j("#fld_emailaddress").removeClass('object_error'); // if necessary $j("#fld_emailaddress").addClass("object_ok"); $j('#email_ac').html('&nbsp;<img src="img/cool.png" align="absmiddle"> <font color="Green"> Your email <strong>'+ emailaddress+'</strong> is OK.</font> '); } else { $j("#fld_username").attr('disabled',true); $j("#fld_password").attr('disabled',true); $j("#cmd_register_submit").attr('disabled',true); $j("#fld_emailaddress").removeClass('object_ok'); // if necessary $j("#fld_emailaddress").addClass("object_error"); $j('#email_ac').html(msg); } } }); });

    Read the article

  • PHP classes totally forgotten something today - sorry

    - by russp
    Hi guys, really sorry about being "totally thick today" but I have forgotten how to do something simple - too much time not in php recently. Want to use the OS phpapi How do I print out the individual rows - see told you I was being thick today // The fields we will be fetching. if (isset($_GET['test']) && $_GET['test'] == 'plaxo') { // plaxo is a PortableContacts end-point so doesn't know about the OpenSocial specific fields $profile_fields = array(); } else { $profile_fields = array( 'aboutMe', 'displayName', 'bodyType', 'currentLocation', 'drinker', 'happiestWhen', 'lookingFor' ); } // The number of friends to fetch. $friend_count = 2; $batch = $osapi->newBatch(); // Fetch the current user. $self_request_params = array( 'userId' => $userId, // Person we are fetching. 'groupId' => '@self', // @self for one person. 'fields' => $profile_fields // Which profile fields to request. ); $batch->add($osapi->people->get($self_request_params), 'self'); // Fetch the friends of the user $friends_request_params = array( 'userId' => $userId, // Person whose friends we are fetching. 'groupId' => '@friends', // @friends for the Friends group. 'fields' => $profile_fields, // Which profile fields to request. 'count' => $friend_count // Max friends to fetch. ); $batch->add($osapi->people->get($friends_request_params), 'friends'); // Get supportedFields Request $batch->add($osapi->people->getSupportedFields(), 'supportedFields'); // Send the batch request. $result = $batch->execute(); Say I wanted to print out "aboutMe", whats the echo? cos echo $result['aboutMe'] doesn't work.

    Read the article

  • OpenSocial create activity from submit click

    - by russp
    Hi I'm "playing with OpsnSocial" and think I get a lot of it (well thanks to Googles' bits) but one question if I may. Creating an activity Lets say I have a form like this (simple) <form> <input type="text" name="" id="testinput" value=""/> <input type="submit" name="" id="" value=""/> </form> And I want to post the value of the text field (and or a message i.e "just posted" to the "users" activity. Do I use a function like this? function createActivity() { if (viewer) { var activity = opensocial.newActivity({ title: viewer.getDisplayName() + ' VALUE FROM FORM '}); opensocial.requestCreateActivity(activity, "HIGH", function() { setTimeout(initAllData,1000); }); } }; If so, how do I pass the text field value to it - is it something like this? var testinput = document.getElementById("testinput"); so the function may look like function createActivity() { if (viewer) { var activity = opensocial.newActivity({ title: viewer.getDisplayName() + testinput }); opensocial.requestCreateActivity(activity, "HIGH", function() { setTimeout(initAllData,1000); }); } }; And how do I trigger the function by using the submit button. In my basic JQuery I would use $('#submitID').submit(function(){ 'bits in here '}); Is at "simple as that i.e. use the createActivity function and it will use the OS framework to "post" to the activity.xml

    Read the article

  • JQuery remove .append after 5 seconds

    - by RussP
    Oh gosh here a lot today - oops Folks, best way to do this: $j('.done').append('Your services have been updated'); (that bits done) but then remove the append after say 5 seconds so that if a person resubmits a form(allowed) the append does not continue adding the text? i.e updated once "Your services have been updated", twice would read "Your services have been updated Your services have been updated" but I would only want Your services have been updated to show once

    Read the article

  • Jquery load into div on toggle

    - by russp
    Not sure if this is possible but can you load and unload into a div on a jquery toggle? something a bit like this? $("#IDOFCLICK").live('click',function(){ $(this).toggleClass("active").('#IDOFDIVTOLOAD').load('PAAGETOLOAD').slideToggle("slow"); }); if you can I guess the above is not right, but, how would you also unload on the "reverse" toggle?

    Read the article

  • Jquery Serialization not working

    - by RussP
    Have a simple form (only extract fields here) but for some reason the JQserilization is not working; looks fine in alert() but only the first form field gets posts. Suggestions please - thanks in advance Form: <form id="neweventform" method="post" action=""> <div class="grid_4 alpha">Setup date *</div> <div class="grid_7 omega"> <select name="setup_day" id="setup_day"><?php days_list(); ?></select> <select name="setup_month" id="setup_month"><?php month_list(); ?></select> <select name="setup_year" id="setup_year"><?php year_list(); ?></select> <div class="grid_11"> <input type="submit" name="createevent" value="Create" id="createevent" /> </div> </form> Jquery $j(document).ready(function(){ $j('#neweventform').live('submit',function () { var data= $j('#neweventform').serialize(); alert(data); $j.ajax({type: "POST", url: "scripts/process.php",data: "newevent=newevent&event_options=" + data, cache: false, complete: function(data){ $j('#neweventform').fadeOut(2000),loading.fadeOut('slow'),$j('#content').fadeIn(2000), $j('#content').load('scripts/events.php #eventslist'); } }); return false; }); }); And the PHP processing if(isset($_POST['newevent'])) : $insert = mysql_query("INSERT INTO events (event_options) VALUES ('".$_POST['event_options']."')"); endif; Any suggestions?

    Read the article

  • jquery ajax form function(data)

    - by RussP
    Can some one please tell me where I have gone wrong. What ever I do I get the answer "no" JQuery to send data to php query $j.post("logincheck.php",{ username:$j('#username').attr('value'), password:$j('#password').attr('value'), rand:Math.random() } , function(data) { if(data=='yes') {alert('yes');} else {alert('no');} } ); Here is the php query if(isset($_POST['username'])): $username = $_POST['username']; $password = $_POST['password']; $posts = mysql_query("SELECT * FROM users WHERE username='$username'"); $no_rows = mysql_num_rows($posts ); while($row = mysql_fetch_array($posts)): print 'yes'; endwhile; else: print 'no'; //header('location: index.php'); endif; endif; Thank in adance

    Read the article

  • JQuery post to php

    - by RussP
    Why is it that I can never get JQuery serialize to work properly. I guess I must be missing something. I can serialize a form data and it shows in an alert: var forminfo = $j('#frmuserinfo').serialize(); alert(forminfo); I then post to my PHP page thus: $j.ajax({ type: "POST", url: "cv-user-process.php", data: "forminfo="+forminfo, cache: false, complete: function(data) { } }); But WHENEVER (not the first time) I try to insert/update the data in the DB I only ever get 1 varaible passed: Here is my PHP script: $testit = mysql_query("UPDATE cv_usersmeta SET inputtest='".$_POST['forminfo']."' WHERE user='X'"); the data passed only ever gets the first variable. why? I think it is more the way I deal with the php but it drives me nuts and always takes me far too long to find where I am going wrong.

    Read the article

  • JQuery UI Sortable

    - by RussP
    Can someone please help me with this one: When using UISortables where - and how do I put "serialize" into the JQuery function? I have 4 columns class '.columm' and each wit a unique id - col1,col2,col3 & col4. I can get the drag & drop bit to work I now need to put the "final" positions into a serialized array. Here is my code: $(".column").sortable({ revert: true, scroll: true, appendTo: 'body', connectWith: '.column', delay:200, stop: function() { $(".column").each(function(){ var test = $(this).attr('id'); alert(test); // //var myArray = $(this).sortable("serialize"); }) }, revertDuration:50000, scope:'scope', opacity: 0.80, }); You will see alert test. I have done this to see if I can get the col id's into an alert and I can, but where do i put .sortable( "serialize" , [options] ) and how do I do that for the 4 columns to create 1 single serialized array? having done that how/where do you set the order when you next load the page? (OK yes, I do intent to "store" the serialized array) Help please - thanks

    Read the article

  • .htaccess redirect question

    - by russp
    I have a slight problem with .htaccess redirect. I have a dynamic site with 2 levels of variables - content="type -(alpha)" and ID="number" but this is very not seo friendly what I really would like to create is a rewrite rule that generates a "friendly" url for serach engines & users alike. Very much like WordPress does. Each ID is already unique (obviously) and on creation is creating a unique "permalink" field so for example ID=1 has a "permalink field" as "2009/10/27/page title" and ID=100 would be "2010/10/27 page title". I would like folder/wall.php?content=type&ID=number to redirect to folder/permalink.php/html/htm (don't mind a non dynamic extension) Any clues? - this is not right (I know) but it also "breaks" my css file RewriteEngine On RewriteRule wall/content/(.*)/ID/(.*)/ wall.php?content=$1&ID=$2 RewriteRule wall/content/(.*)/ID/(.*) wall.php?content=$1&ID=$2

    Read the article

  • Think this is a naming problem

    - by RussP
    Must be really dumb today - sorry in advance; anyhow have this unordered list <ul> <li><div class="openuserform" >Info</div> <div class="userform"></div></li> <li><div class="openuserform" >Appearence</div> <div class="userform"></div></li> <li><div class="openuserform" >Pages</div> <div class="userform"></div></li> <li><div class="openuserform" >Services</div> <div class="userform"></div></li> <li><div class="openuserform" >Community</div> <div class="userform"></div></li> </ul> which on click <div class="openuserform" > I want to load a separate form e.g. $('.openusersform').live('click',(function(){ $('.userform').load('form page.php'); }); OK I can get the forms to load in the right div using $(this).next('.userform').show(); $('.userform').load('form page.php'); but it's very ugly (I think) and I can only every get the first form to process propery. It is laid out like (ul,li etc.) this so I can have each loaded form aligned under the relevant li. But I think there has to be a better way as I do not seem to get any if(){} stemnents working to process the forms i.e. if(form1){ $.ajax etc } if (form2) {more ajax} Suggestions please - thanks

    Read the article

  • JQuery multiple id index with form submit

    - by RussP
    Hi folks, not sure how to do this as ID's are ment to be unique but this is a dynamically series of forms generated from a php array - based on reading the file names in a directory - with the same ID. What I need to do is identify which form so the data can be processed. Here is the form echo '<form method="post" action="" id="frmwidget">'; echo '<tr>'; echo '<td>'; echo ucfirst($comments[0]); echo '</td><td>'; echo $comments[1]; echo '</td><td align="center">'; echo '<input type="checkbox">'; echo '</td>'; echo '</td><td align="center">'; echo '<input type="checkbox">'; echo '</td>'; echo '</td><td align="center">'; echo '<input type="checkbox">'; echo '</td>'; echo '</td><td align="center">'; echo '<input type="submit" id="cmdwidgets">'; echo '</td>'; echo '</tr>'; echo '</form>'; And here is my start of the Jquery $j(document).ready(function() { $j('#cmdwidgets').live('click',function(){ alert('Your widgets will load'); I will want to Ajax the form in here .. not just an alert $j('#wall').load("admin/inc/ajax-widgets.php"); return false; }); }); Yes I know the form could be 1 form not multiples, but for this purpose it needs to be multiple forms. And yes I know the form is incomplete i.e. field names etc. Any help/suggestions please - thanks in advance

    Read the article

  • JQuery duplicate alerts on update? why?

    - by russp
    I have this JQuery function - that nearly works (so far!) BUT the alerts are duplicated, each appears twice any clues/ideas please $(function() { $("#col1, #col2, #col3").sortable({ connectWith: '.column', update : function () { serial = $('#col1').sortable('serialize'); serial1 = $('#col2').sortable('serialize'); serial2 = $('#col3').sortable('serialize'); alert(serial); alert(serial1); alert(serial2); } }); });

    Read the article

  • php string to array and split

    - by RussP
    Hi folks Looking for suggestions as to the best way to do this (I know there are many options): take a variable like this: $args = ('post_type=post&order_by=DESC&limit=10'); the create a function to convert that variable into parts like this: $post_type = post; $order_by = DESC; $limit= 10; Reason is I want a client to be able to use a string like the first to pass variables to a sql query in much the same way (but doesn't have to be exact) as you can do it in WordPress.

    Read the article

1