Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X > OS X 10.8 Mountain Lion

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 29, 2013, 11:02 AM   #1
titusfx
macrumors newbie
 
Join Date: Mar 2013
Question How to make a post with Widget?

Im trying using this function

function post_to_url(path, params, method) {
method = method || "post"; // Set method to post by default, if not specified.

// The rest of this code assumes you are not using a library.
// It can be made less wordy if you use one.
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);

for(var key in params) {
if(params.hasOwnProperty(key)) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params[key]);

form.appendChild(hiddenField);
}
}

document.body.appendChild(form);
form.submit();
}

but doesnt work, it says that is a incorrect request and in firebug works ok.
The params are the way {key:value, ..., keyN:valueN}

How i can make a post?
titusfx is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X > OS X 10.8 Mountain Lion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Make an app which can post on a forum ? movemushroom Mac Programming 2 Jun 4, 2013 09:13 AM
Weather Widget color has changed, clock widget Aspen OS X 10.8 Mountain Lion 2 Apr 6, 2013 12:59 PM
How can I make Apple or other tech companies to make this possible and get paid too piatti Apple, Industry and Internet Discussion 15 Mar 19, 2013 06:19 AM
developers can make some rad apps/games..do you think they could make a facebook app? aliensarecool Wasteland 1 Aug 25, 2012 04:16 PM
Wouldnt it make more sense for them to make the screen wider as well? krashx7 iPhone 58 Jul 10, 2012 06:52 AM

Forum Jump

All times are GMT -5. The time now is 06:26 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC