Search Results

Search found 4088 results on 164 pages for 'params keyword'.

Page 36/164 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • How do you assign a variable with the result of a if..else block?

    - by Pierre Olivier Martel
    I had an argument with a colleague about the best way to assign a variable in an if..else block. His orignal code was : @products = if params[:category] Category.find(params[:category]).products else Product.all end I rewrote it this way : if params[:category] @products = Category.find(params[:category]).products else @products = Product.all end This could also be rewritten with a one-liner using a ternery operator (? :) but let's pretend that product assignment was longer than a 100 character and couldn't fit in one line. Which of the two is clearer to you? The first solution takes a little less space but I thought that declaring a variable and assigning it three lines after can be more error prone. I also like to see my if and else aligned, makes it easier for my brain to parse it!

    Read the article

  • How do I use accepts_nested_attributes_for? I cannot use the .build method (!)

    - by Angela
    Editing my question for conciseness and to update what I've done: How do I model having multiple Addresses for a Company and assign a single Address to a Contact, and be able to assign them when creating or editing a Contact? Here is my model for Contacts: class Contact < ActiveRecord::Base attr_accessible :first_name, :last_name, :title, :phone, :fax, :email, :company, :date_entered, :campaign_id, :company_name, :address_id, :address_attributes belongs_to :company belongs_to :address accepts_nested_attributes_for :address end Here is my model for Address: class Address < ActiveRecord::Base attr_accessible :street1, :street2, :city, :state, :zip has_many :contacts end I would like, when creating an new contact, access all the Addresses that belong to the other Contacts that belong to the Company. So here is how I represent Company: class Company < ActiveRecord::Base attr_accessible :name, :phone, :addresses has_many :contacts has_many :addresses, :through => :contacts end Here is how I am trying to create a field in the View for _form for Contact so that, when someone creates a new Contact, they pass the address to the Address model and associate that address to the Contact: <% f.fields_for :address, @contact.address do |builder| %> <p> <%= builder.label :street1, "Street 1" %> </br> <%= builder.text_field :street1 %> <p> <% end %> When I try to Edit, the field for Street 1 is blank. And I don't know how to display the value from show.html.erb. At the bottom is my error console -- can't seem to create values in the address table: My Contacts controller is as follows: def new @contact = Contact.new @contact.address.build # I GET AN ERROR HERE: says NIL CLASS @contact.date_entered = Date.today @campaigns = Campaign.find(:all, :order => "name") if params[:campaign_id].blank? else @campaign = Campaign.find(params[:campaign_id]) @contact.campaign_id = @campaign.id end if params[:company_id].blank? else @company = Company.find(params[:company_id]) @contact.company_name = @company.name end end def create @contact = Contact.new(params[:contact]) if @contact.save flash[:notice] = "Successfully created contact." redirect_to @contact else render :action => 'new' end end def edit @contact = Contact.find(params[:id]) @campaigns = Campaign.find(:all, :order => "name") end Here is a snippet of my error console: I am POSTING the attribute, but it is not CREATING in the Address table.... Processing ContactsController#create (for 127.0.0.1 at 2010-05-12 21:16:17) [POST] Parameters: {"commit"="Submit", "authenticity_token"="d8/gx0zy0Vgg6ghfcbAYL0YtGjYIUC2b1aG+dDKjuSs=", "contact"={"company_name"="Allyforce", "title"="", "campaign_id"="2", "address_attributes"={"street1"="abc"}, "fax"="", "phone"="", "last_name"="", "date_entered"="2010-05-12", "email"="", "first_name"="abc"}} Company Load (0.0ms)[0m [0mSELECT * FROM "companies" WHERE ("companies"."name" = 'Allyforce') LIMIT 1[0m Address Create (16.0ms)[0m [0;1mINSERT INTO "addresses" ("city", "zip", "created_at", "street1", "updated_at", "street2", "state") VALUES(NULL, NULL, '2010-05-13 04:16:18', NULL, '2010-05-13 04:16:18', NULL, NULL)[0m Contact Create (0.0ms)[0m [0mINSERT INTO "contacts" ("company", "created_at", "title", "updated_at", "campaign_id", "address_id", "last_name", "phone", "fax", "company_id", "date_entered", "first_name", "email") VALUES(NULL, '2010-05-13 04:16:18', '', '2010-05-13 04:16:18', 2, 2, '', '', '', 5, '2010-05-12', 'abc', '')[0m

    Read the article

  • Create fulltext index on a VIEW

    - by kylex
    Is it possible to create a full text index on a VIEW? If so, given two columns column1 and column2 on a VIEW, what is the SQL to get this done? The reason I'd like to do this is I have two very large tables, where I need to do a FULLTEXT search of a single column on each table and combine the results. The results need to be ordered as a single unit. Suggestions? EDIT: This was my attempt at creating a UNION and ordering by each statements scoring. (SELECT a_name AS name, MATCH(a_name) AGAINST('$keyword') as ascore FROM a WHERE MATCH a_name AGAINST('$keyword')) UNION (SELECT s_name AS name,MATCH(s_name) AGAINST('$keyword') as sscore FROM s WHERE MATCH s_name AGAINST('$keyword')) ORDER BY (ascore + sscore) ASC sscore was not recognized.

    Read the article

  • No route matches when trying to edit

    - by mmichael
    Here's the scoop: I've created a test app that allows users to create ideas and then add "bubbles" to these ideas. Currently, a bubble is just text. I've successfully linked bubbles to ideas. Furthermore, when a user goes to view an idea it lists all of the bubbles attached to that idea. The user can even delete the bubble for any given idea. My problem lies in editing bubbles. When a user views an idea, he sees the idea's content as well as any bubbles for that idea. As a result, I've set all my bubble controls (editing and deleting) inside the ideas "show" view. My code for editing a bubble for an idea is <%= link_to 'Edit Bubble', edit_idea_bubble_path %>. I ran rake routes to find the correct path for editing bubbles and that is what was listed. Here's my error: No route matches {:action=>"edit", :controller=>"bubbles"} In my bubbles controller I have: def edit @idea = Idea.find(params[:idea_id]) @bubble = @idea.bubbles.find(params[:id]) end def update @idea = Idea.find(params[:idea_id]) @bubble = @idea.bubbles.find(params[:id]) respond_to do |format| if @bubble.update_attributes(params[:bubble]) format.html { redirect_to(@bubble, :notice => 'Bubble was successfully updated.') } format.xml { head :ok } else format.html { render :action => "Edit" } format.xml { render :xml => @bubble.errors, :status => :unprocessable_entity } end end end To go a step further, I have the following in my routes.rb file resources :ideas do resources :bubbles end So far everything seems to function except when I try to edit a bubble. I'd love some guidance. Thanks!

    Read the article

  • jquery thickbox height problem

    - by Swami
    My thickbox renders correctly in my dev environment, but in prod, the default height kicks in even though I'm supplying width and height params. TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL ajaxContentW = TB_WIDTH - 30; ajaxContentH = TB_HEIGHT - 45; Any thoughts on why this might be happening?

    Read the article

  • Send HTTPService Request in flex 3 with '-' in the URl Paramerters to get Google Feeds

    - by Goysar
    I am developing application in flex 3 which interacts with the Google feeds to produce my results. The URL to which i want to send request is something like this http://books.google.com/books/feeds/volumes?q=football+-soccer&start-index=11&max-results=10 Now i can send and receive results with q parameter, but in the next two parameters has a '-' (start-index and max-results). I am using HTTPService to send the requeset like this. SearchService.url = "http://books.google.com/books/feeds/volumes"; SearchService.method = "GET"; SearchService.contentType = "application/x-www-form-urlencoded" Here SearchService is the HTTPService var params:Object = new Object(); params.q = searchText; params.start-index = 11; params.max-results = 100; service.SearchService.send(params); Now my flex IDE throws me a error stating 'Cannot assign a non-reference value'. Only if i send the request with this parameters, i could put pagination in my application. So how can i send HTTPService request with '-' in the URL parameters?

    Read the article

  • Rails - Seeking a Dry authorization method compatible with various nested resources

    - by adam
    Consensus is you shouldn't nest resources deeper than 1 level. So if I have 3 models like this (below is just a hypothetical situation) User has_many Houses has_many Tenants and to abide by the above i do map.resources :users, :has_many => :houses map.resorces :houses, :has_many => :tenants Now I want the user to be able edit both their houses and their tenants details but I want to prevent them from trying to edit another users houses and tenants by forging the user_id part of the urls. So I create a before_filter like this def prevent_user_acting_as_other_user if User.find_by_id(params[:user_id]) != current_user() @current_user_session.destroy flash[:error] = "Stop screwing around wiseguy" redirect_to login_url() return end end for houses that's easy because the user_id is passed via edit_user_house_path(@user, @house) but in the tenents case tenant house_tenent_path(@house) no user id is passed. But I can get the user id by doing @house.user.id but then id have to change the code above to this. def prevent_user_acting_as_other_user if params[:user_id] @user = User.find(params[:user_id] elsif params[:house_id] @user = House.find(params[:house_id]).user end if @user != current_user() #kick em out end end It does the job, but I'm wondering if there is a more elegant way. Every time I add a new resource that needs protecting from user forgery Ill have to keep adding conditionals. I don't think there will be many cases but would like to know a better approach if one exists.

    Read the article

  • How to combine array list string in java ?

    - by tiendv
    I have some arraylist string with keyword inside like that ! A windows is arraylist string with keyword is bold Struct of window : 9 words before + keyword + 9 words after You can see some window overlaping How to i combine that arraylist to receive like that : Thanks

    Read the article

  • How to make if loop in grails?

    - by user3569696
    I'm beginner in Grails, please help. I have this in my gsp <div class="right66"> <g:select class="time_pick" name="pick_day" placeholder="" from="${['Dani', 'Sati', 'Minute']}" valueMessagePrefix="book.category"/> </div> In translation: Dani=Days, Sati= Hours, Minute= Minutes. I need to save data in minutes but User have privilege to choose will his input be in minutes, days or hours. So i have to do if loop. I now how if loop works but i don't know how to wite it in grails. I was thinking something like this: n=1 if(params.type=Dani){ n= 3600 }else if(params.type=Sati) { n=60 } def minute=params.minute*n but how to call that choosen input "Dani"? I can't write Params.type=Dani. Does if loop go in controller in my case?

    Read the article

  • Why is my asp.net mvc form POSTing instead of GETting?

    - by quakkels
    My code is straightforward enough: <% using(Html.BeginForm(FormMethod.Get)) %> <% { %> Search for in Screen Name and Email: <%: Html.TextBox("keyword", Request.QueryString["keyword"]) %> <button type=submit>Search</button> <% } %> The issue I'm running into is that when I submit this form, the values are not added to the querystring. Instead, it appears that the form is submitting by a post request. When I look at the generated HTML, I have this: <form action="/find/AdminMember/MemberList" method="post"> Search for in Screen Name and Email: <input id="keyword" name="keyword" type="text" value="" /> <button type=submit>Search</button> </form> Does anyone know why? This seems pretty simple and straighforward to me.

    Read the article

  • How to translate a config.ini file into C#.NET objects

    - by JACK IN THE CRACK
    config.ini: [globalloads] plugin.SWPlugin = 1 plugin.SWPlugin.params.1 = true plugin.SWPlugin.params.2 = 10 [testz : globballoads] plugin.SWPlugin.params.2 = 20 Simple enough? // load testz config and programmatically create this equivalent code: SWPluginAbstract p = new SWPlugin(true, 20); If a different config.ini setup is needed to do that, it's not a problem...

    Read the article

  • Invalid Token when using XPath

    - by Andy5
    Hi I am making a modification to a web application using XPath, and when executed I get an error message - Invalid token! This is basic what I am doing public xmlNode GetSelection (SelectParams params, xmldocument docment) { xpathstring = string.format("Name =\'{0}' Displaytag = \'{1}' Manadatory=\'{2}', params.Name, params.Displaytag, params.Manadatory); return document.selectsinglenode(xpathstring); } As you can see, I am making a string and setting values on the nodes I am trying to find against my xml document, and thus returning xml data that matches my parameters. What is happening is that I am getting an xpathexeception error in Visual Studio and it says invalid token. I do know that in the xml document that the parameters I am looking in the tags have double quotes, for example, Name="ABC". So, I thought the problem could be solved using an "\". Can anyone help? Update from comments In the Xml Document, the tag has attributes where they are set as Name="ABC" Displaytag="ATag" Manadatory="true".

    Read the article

  • SQL Filter Multiple Tables Data

    - by Brad
    If it matters, I'm using Firebird 2.1 database. I have three tables, one with keywords, one with negative keywords, and the other with required keywords. I need to be able to filter the data so the output has just the keywords that meat the stipulation of not being in the negative keyword list, and IF there are any required words, then it will require the results to have those keywords in the end result. The tables are very similar, the field in the tables that I would be matching against are all called keyword. I don't know SQL very well at all. I'm guessing it would be something like SELECT keyword from keywordstable where keyword in requiredkeywordstable and where NOT in negativekeywordstable Just a side note, The required keywords table could be empty which would mean there are no required keywords. Any help would be appreciated. -Brad

    Read the article

  • adding a div with data()

    - by Dizzy Bryan High
    Hi people am generating a list of flash swfs, the information comes from an ajax call which returns a json object which i loop through to create the rows of data using my makeAppRow function. makeAppRow = function(myData){ var myStr = '<div class="fileEntry">' myStr = myStr +'<div class="appDate">'+dateFormat(myData.date_swf, "dS mmmm, yyyy, h:MM TT")+'</div>' myStr = myStr +'<div class="appName">'+myData.name_swf+'</div>' myStr = myStr +'<div class="appOptions" data>' myStr = myStr +'<div class="gotoAppBtn" data-options="'+myData+'">Open App</div>' myStr = myStr +'</div>' myStr = myStr +'</div>' $('#appData').append(myStr); } I need the json data to be attached to the gotoAppBtn so that when its clicked i can read in the data from the attached json object and use it in my click function, as you can see ive been trying to embed the data using the html5 data but i cant get it to work. <div class="gotoAppBtn" data-options="'+myData+'">Open App</div> i have a function so that when the button is clicked it loads in an swf. $('.gotoAppBtn').live('click', function(){ //alert('button clicked') var myData = $(this).data("options") alert('../userfiles/'+myData.id_ugp+'/'+myData.id_swf+'/'+myData.launchfile_swf+'') console.log(myData); var flashvars = {}; var params = {}; params.menu = "false"; params.quality = "best"; params.scale = "noscale"; var attributes = {}; attributes.id = "flashAppDisplay"; attributes.name = "flashAppDisplay"; swfobject.embedSWF( '../userfiles/'+myData.id_ugp+'/'+myData.id_swf+'/'+myData.launchfile_swf+'', 'flashAppDisplay', myData.width_swf, myData.height_swf, myData.version_swf ,"../FAVideo/expressInstall.swf", flashvars, params, attributes) }); but the data does not seem to be there, any pointers on where i am going wrong, or a better way to achive this???

    Read the article

  • Paperclip: "missing" image when uses has_one

    - by EricR
    I'm working on a website that allows people who run bed and breakfast businesses to post their accommodations. I would like to require that they include a "profile image" of the accommodation when they post it, but I also want to give them the option to add more images later (this will be developed after). I thought the best thing to do would be to use the Paperclip gem and have a Accommodation and a Photo in my application, the later belonging to the first as an association. A new Photo record is created when they create an Accommodation. It has both id and accommodation_id attributes. However, the image is never uploaded and none of the Paperclip attributes get set (image_file_name: nil, image_content_type: nil, image_file_size: nil), so I get Paperclip's "missing" photo. Any ideas on this one? It's been keeping me stuck for a few days now. Accommodation models/accommodation.rb class Accommodation < ActiveRecord::Base validates_presence_of :title, :description, :photo, :thing, :location attr_accessible :title, :description, :thing, :borough, :location, :spaces, :price has_one :photo end controllers/accommodation_controller.erb class AccommodationsController < ApplicationController before_filter :login_required, :only => {:new, :edit} uses_tiny_mce ( :options => { :theme => 'advanced', :theme_advanced_toolbar_location => 'top', :theme_advanced_toolbar_align => 'left', :theme_advanced_buttons1 => 'bold,italic,underline,bullist,numlist,separator,undo,redo', :theme_advanced_buttons2 => '', :theme_advanced_buttons3 => '' }) def index @accommodations = Accommodation.all end def show @accommodation = Accommodation.find(params[:id]) end def new @accommodation = Accommodation.new end def create @accommodation = Accommodation.new(params[:accommodation]) @accommodation.photo = Photo.new(params[:photo]) @accommodation.user_id = current_user.id if @accommodation.save flash[:notice] = "Successfully created your accommodation." render :action => 'show' else render :action => 'new' end end def edit @accommodation = Accommodation.find(params[:id]) end def update @accommodation = Accommodation.find(params[:id]) if @accommodation.update_attributes(params[:accommodation]) flash[:notice] = "Successfully updated accommodation." render :action => 'show' else render :action => 'edit' end end def destroy @accommodation = Accommodation.find(params[:id]) @accommodation.destroy flash[:notice] = "Successfully destroyed accommodation." redirect_to :inkeep end private def check_owner end end views/accommodations/_form.html.erb <%= form_for @accommodation, :html => {:multipart => true} do |f| %> <%= f.error_messages %> <p> Title<br /> <%= f.text_field :title, :size => 60 %> </p> <p> Description<br /> <%= f.text_area :description, :rows => 17, :cols => 75, :class => "mceEditor" %> </p> <p> Photo<br /> <%= f.file_field :photo %> </p> [... snip ...] <p><%= f.submit %></p> <% end %> Photo The controller and views are still the same as when Rails generated them. models/photo.erb class Photo < ActiveRecord::Base attr_accessible :image_file_name, :image_content_type, :image_file_size belongs_to :accommodation has_attached_file :image, :styles => { :thumb=> "100x100#", :small => "150x150>" } end

    Read the article

  • MVC + Extjs + IIS6 + Wildcard Mapping = Post Form resulting in 302 object moved

    - by Orkun Balkanci
    Everything seems to work fine until i want to submit the form and update the database. Wildcard mapping works on requests like "/navigation/edit/1", but when i submit the form as: var ajaxPost = function(Url, Params) { Ext.Ajax.request({ url: Url, params: Params, method: 'POST', async: false, scope: this }); }; it says "200 bad response: syntax error" and in firebug there is "Failed to load source for: http://.../Navigation/edit/1". Any help?

    Read the article

  • Rails - Find Condition of two model fields

    - by ChrisWesAllen
    I'm trying to find the results of a model where it queries as the result of two conditions. I have a search tag that looks for Model.find(:all, :conditions => "name LIKE params[search]") but I'd like for the search to find all records where "name LIKE params[search] or description LIKE params[search] . Is there any way to add an OR into a condition in rails? or should I make an if statement?

    Read the article

  • Problem With Inserts of multibyte (converted to utf-8) strings in the mysql tables of utf_unicode_ci encoding

    - by user381595
    http://domainsoutlook.com/sandbox/keyword/?s=http://bhaskar.com raw example of my keyword density analyser. Every keyword shows up properly with no problems in unicode conversions etc. Now, When I am adding these words to the database column of a table, the words show up as messed up. http domainsoutlook.com/b/site/bhaskar.com.html For example on this front end page if you see there is a keyword that is shown as a blank but still occurs on the website 8 times. (It isnt empty in the database though). I have checked and there is no problem with mysql_real_escape_String...because the output stays the same before and after the word is gone through mysql_real_escape_String. Another problem was that I wanted to fix my urls for arabic language. They should be showing up as /word-{1st letter of the word}/{whole word}.html but its showing as /word-{whole word}/{1st letter of the word}.html I really need answers for these two questions.

    Read the article

  • xDocklet, Maven and Hibernate

    - by Vinothbabu
    I am having some trouble setting up xDocklet and getting this error. Error resolving version for plugin 'xdoclet:maven2-xdoclet2-plugin' from the repositories <pluginRepositories> <pluginRepository> <id>codehaus-plugins</id> <url>http://dist.codehaus.org/</url> <layout>legacy</layout> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </pluginRepository> </pluginRepositories> <plugin> <groupId>xdoclet</groupId> <artifactId>maven2-xdoclet2-plugin</artifactId> <executions> <execution> <id>xdoclet</id> <phase>generate-sources</phase> <goals> <goal>xdoclet</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>xdoclet-plugins</groupId> <artifactId>xdoclet-plugin-qtags</artifactId> <version>1.0.4-SNAPSHOT</version> </dependency> <dependency> <groupId>xdoclet-plugins</groupId> <artifactId>xdoclet-taglib-qtags</artifactId> <version>1.0.4-SNAPSHOT</version> </dependency> </dependencies> <goals> <goal>xdoclet</goal> </goals> <configuration> <configs> <config> <components> <component> <classname>org.xdoclet.plugin.qtags.impl.QTagImplPlugin</classname> </component> <component> <classname>org.xdoclet.plugin.qtags.impl.QTagLibraryPlugin</classname> <params> <packagereplace>org.xdoclet.plugin.${xdoclet.plugin.namespace}.qtags</packagereplace> </params> </component> <component> <classname>org.xdoclet.plugin.qtags.doclipse.QTagDoclipsePlugin</classname> <params> <filereplace>qtags.xml</filereplace> <namespace>${xdoclet.plugin.namespace}</namespace> </params> </component> <component> <classname>org.xdoclet.plugin.qtags.confluence.QTagConfluencePlugin</classname> <params> <destdir>${project.build.directory}/tag-doc</destdir> <namespace>${xdoclet.plugin.namespace}</namespace> <filereplace>${xdoclet.plugin.namespace}.confluence</filereplace> </params> </component> </components> <includes>**/*.java</includes> <params> <destdir>${project.build.directory}/generated-resources/xdoclet</destdir> </params> </config> </configs> </configuration> </plugin> Some of my questions. Would you recommend me with going with xDocklet. Is there any alternative for it? Is it one of the best way, as hbm's does get generated automatically. Any suggestions on the way how my Java Objects should get persisted in the DB? Any good tutorials over xDocklet Maven and Hibernate. I am using xDocklet to generate HBM's automatically by annotating my POJO's.

    Read the article

  • Java return to position N in call stack.

    - by Finbarr
    Using the return keyword in Java code will return execution to the last piece of calling code in the call stack. If object foo calls baz.bar(), the return keyword in the bar method will continue code execution in foo. Let's say I have object foo that calls foofoo that calls foofoofoo in the above scenario, and foofoofoo calls baz.bar(). Is there anyway in Java to use the return keyword, or something else, so that the code in the bar method can return all the way back up to foo? (WITHOUT THROWING AN EXCEPTION)

    Read the article

  • Link redirects to "show" action instead of the indicated in routes.rb

    - by Brian Roisentul
    I'm working with Ruby on rails 2.3.4 and I'd like to have a link that executes an action when clicked. The relevant part of the routes.rb file looks like this: map.search_filter_relevance "/anuncios/buscar", :controller => 'announcements', :action => 'search_filter_relevance' My view(it's the model's index page) looks like this: <%= link_to 'M&Aacute;S RELEVANTES', search_filter_relevance_path %> And my controller looks like this: def search_filter_relevance raise params.inspect unless params[:announcements].nil? or params[:announcements].empty? @announcements = params[:announcements].order_by_featured end end The problem is that when I click the link I get an error due to some null value in the Show action! I'm not accessing that action at all...why is executing it?

    Read the article

  • Rails - Posting a Boolean (true or False) and updating the DB in the controller

    - by AnApprentice
    Hello, in my Rails 3 App, I'm posting with jQuery the following: http://0.0.0.0:3000/topics/read_updater?&topic_id=101&read=true In my controller: def read_updater current_user.topics.where(:topic_id => params[:topic_id]).update_all(:read => params[:read]) render :json => {:status => 'success' } end params[:conversation_id] works great, but params[:read] is inserting empty values in the DB, even though jQuery is posting either a true or false. Ideas? I want rails to update the DB with either true or false. Thanks

    Read the article

  • how topass value to controller??

    - by rajesh
    hi all, actuallly when i trying to pass url value to controller action, action is not getting the required value... i ma sending the value like this function value(url,id) { alert(url); document.getElementById('rating').innerHTML=id; var params = 'artist='+id; alert(params); // var newurl='http://localhost/songs_full/public/eslresult/ratesong/userid/1/id/27'; var myAjax = new Ajax.Request(newurl,{method: 'post',parameters:params,onComplete: loadResponse}); //var myAjax = new Ajax.Request(url,{method:'POST',parameters:params,onComplete: load}); //alert(myAjax); } function load(http) { alert('success'); } and in controller i hav write like public function ratesongAction() { $user=$_POST['rating']; echo $user; $post= $this->getRequest()->getPost(); //echo $post; $ratesongid= $this->_getParam('id'); but still not getting the result i am using zend framework

    Read the article

  • python destructuring-bind dictionary contents

    - by Stephen
    Hi, I am trying to 'destructure' a dictionary and associate values with variables names after its keys. Something like params = {'a':1,'b':2} a,b = params.values() but since dictionaries are not ordered, there is no guarantee that params.values() will return values in the order of (a,b). Is there a nice way to do this? Thanks

    Read the article

  • Passing dynamic parameters to a stored procedure in SQL Server 2008

    - by themhz
    I have this procedure that executes another procedure passed by a parameter and its parameters datefrom and dateto. CREATE procedure [dbo].[execute_proc] @procs varchar(200), @pdatefrom date, @pdateto date as exec @procs @datefrom=@pdatefrom,@dateto=@pdateto But I need to also pass the parameters dynamically without the need to edit them in the procedure. For example, what I am imagining is something like this CREATE procedure [dbo].[execute_proc] @procs varchar(200), @params varchar(max) as exec @procs @params where @params is a string like @param1=1,@param2='somethingelse' Is there a way to do this?

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >